All pastes #931244 Raw Edit

Untitled

public python v1 · immutable
·published 2008-03-07 01:25 UTC
rendered paste body
#!/usr/bin/pythonimport clutter# broken# stage size set in ClutterScriptscript_data = """{  "My Scene" : {    "id" : "main-stage",    "type" : "ClutterStage",    "color" : "white",    "width" : 800,    "height" : 800,    "scale-x" : 1.0,    "scale-y" : 1.0,    "children" : [      {        "id" : "full",        "type" : "ClutterRectangle",        "color" : "black",        "x" : "0%",	"y" : "0%", 	"width" : "100%", 	"height" : "100%",        "visible" : true,      },      {        "id" : "top-left",        "type" : "ClutterRectangle",        "color" : "blue",        "x" : "0%",	"y" : "0%", 	"width" : "50%", 	"height" : "50%",        "visible" : true,      },      {        "id" : "bottom-right",        "type" : "ClutterRectangle",        "color" : "green",        "x" : "50%",	"y" : "50%", 	"width" : "50%", 	"height" : "50%",        "visible" : true,      },    ]  }}"""class Main:    def __init__(self):        self.script = clutter.Script()        self.script.load_from_data(script_data, -1)                self.stage = self.script.get_object("main-stage")                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.show_all()            def run(self):        clutter.main()    if __name__ == "__main__":    main = Main()    main.run()