window = gtk.Window() # window.connect('destroy', gtk.main_quit) print(window) window.set_title("ctypes clutter test") vbox = gtk.VBox(False, 6) window.add(vbox) embed = clutter.gtk_clutter_embed_new() vbox.pack_start(embed, True, True, 0) embed.set_size_request(300, 300) # we need to realize the widget before we get the stage embed.realize() print("embed realized") stage = clutter.gtk_clutter_embed_get_stage(embed) # embed.get_stage() clr = clutter.color_new(0, 0, 127, 100) clutter.clutter_stage_set_color(stage, clr) rect = clutter.rectangle_new() # clutter.Rectangle() clr = clutter.color_new(100, 1, 0, 100) clutter.rectangle_set_color(rect, clr) # rect.set_color( clr ) rect.set_size(100, 100) rect.set_anchor_point(50, 50) rect.set_position(150, 150) rect.set_rotation(clutter.CLUTTER_X_AXIS, 45.0, 0, 0, 0) clutter.container_add_actor(stage, rect) tex = clutter.texture_new_from_file("/usr/share/pixmaps/splash/gnome-splash.png", None) # clutter.clutter_texture_set_from_file(tex,'/usr/share/pixmaps/splash/gnome-splash.png') tex.set_size(100, 100) tex.set_anchor_point(50, 50)
* #GtkClutterEmbed is a GTK+ widget embedding a #ClutterStage. Using * a #GtkClutterEmbed widget is possible to build, show and interact with * a scene built using Clutter inside a GTK+ application. * * <note>To avoid flickering on show, you should call gtk_widget_show() * or gtk_widget_realize() before calling clutter_actor_show() on the * embedded #ClutterStage actor. This is needed for Clutter to be able * to paint on the #GtkClutterEmbed widget.</note> * * Since: 0.6 */ ''' embed.realize() print('embed realized') stage = clutter.gtk_clutter_embed_get_stage(embed) clr = clutter.color_new(0, 0, 127, 10) clutter.stage_set_color(stage, clr) clutter.actor_show(stage) clutter.container_add_actor(stage, ACTOR) def sayhi(b, actor): print('hello world', actor) if actor.get_scale()[0] < 1.0: scale = 1.5 else: scale = 0.75 actor.animate( clutter.CLUTTER_LINEAR, 500, scale_x=scale, )
* #GtkClutterEmbed is a GTK+ widget embedding a #ClutterStage. Using * a #GtkClutterEmbed widget is possible to build, show and interact with * a scene built using Clutter inside a GTK+ application. * * <note>To avoid flickering on show, you should call gtk_widget_show() * or gtk_widget_realize() before calling clutter_actor_show() on the * embedded #ClutterStage actor. This is needed for Clutter to be able * to paint on the #GtkClutterEmbed widget.</note> * * Since: 0.6 */ ''' embed.realize() print('embed realized') stage = clutter.gtk_clutter_embed_get_stage( embed ) clr = clutter.color_new( 0,0,127,10 ) clutter.stage_set_color(stage, clr) clutter.actor_show( stage ) clutter.container_add_actor( stage, ACTOR ) def sayhi(b, actor): print('hello world', actor) if actor.get_scale()[0] < 1.0: scale = 1.5 else: scale = 0.75 actor.animate( clutter.CLUTTER_LINEAR, 500, scale_x=scale, ) for i in range(10):
window = gtk.Window() #window.connect('destroy', gtk.main_quit) print(window) window.set_title('ctypes clutter test') vbox = gtk.VBox(False, 6) window.add(vbox) embed = clutter.gtk_clutter_embed_new() vbox.pack_start(embed, True, True, 0) embed.set_size_request(300, 300) # we need to realize the widget before we get the stage embed.realize() print('embed realized') stage = clutter.gtk_clutter_embed_get_stage(embed) #embed.get_stage() clr = clutter.color_new(0, 0, 127, 100) clutter.clutter_stage_set_color(stage, clr) rect = clutter.rectangle_new() #clutter.Rectangle() clr = clutter.color_new(100, 1, 0, 100) clutter.rectangle_set_color(rect, clr) #rect.set_color( clr ) rect.set_size(100, 100) rect.set_anchor_point(50, 50) rect.set_position(150, 150) rect.set_rotation(clutter.CLUTTER_X_AXIS, 45.0, 0, 0, 0) clutter.container_add_actor(stage, rect) tex = clutter.texture_new_from_file( '/usr/share/pixmaps/splash/gnome-splash.png', None) #clutter.clutter_texture_set_from_file(tex,'/usr/share/pixmaps/splash/gnome-splash.png') tex.set_size(100, 100)