rendered paste body#!/usr/bin/pythonimport clutter# working# stage size set in pythonscript_data = """{ "id" : "full", "type" : "ClutterRectangle", "color" : "black", "x" : "0%", "y" : "0%", "width" : "100%", "height" : "100%", "visible" : true, "reactive" : true,}{ "id" : "top-left", "type" : "ClutterRectangle", "color" : "blue", "x" : "0%", "y" : "0%", "width" : "50%", "height" : "50%", "visible" : true, "reactive" : true,}{ "id" : "bottom-right", "type" : "ClutterRectangle", "color" : "green", "x" : "50%", "y" : "50%", "width" : "50%", "height" : "50%", "visible" : true, "reactive" : true,}"""class Main: def __init__(self): self.stage = clutter.Stage() self.stage.set_color(clutter.color_parse("white")) self.stage.set_size(800,800) self.script = clutter.Script() self.script.load_from_data(script_data, -1) (top_left, bottom_right) = self.script.get_objects("top-left", "bottom-right") print "stage width = ", self.stage.get_width() print "stage height = ", self.stage.get_height() self.stage.connect('key-press-event', clutter.main_quit) top_right = clutter.Rectangle() top_right.set_size(self.stage.get_width()/2, self.stage.get_height()/2) top_right.set_position(self.stage.get_width()/2, 0) top_right.set_color(clutter.color_parse("yellow")) bottom_left = clutter.Rectangle() bottom_left.set_size(self.stage.get_width()/2, self.stage.get_height()/2) bottom_left.set_position(0, self.stage.get_height()/2) bottom_left.set_color(clutter.color_parse("red")) self.stage.add(top_right,bottom_left) self.stage.add(top_left,bottom_right) self.stage.show_all() def run(self): clutter.main() if __name__ == "__main__": main = Main() main.run()