#!/usr/bin/python
from gi.repository import Gtk, Clutter, GtkClutter
storedWidth = 0
storedHeight = 0
def on_clicked(b, actor):
global storedWidth, storedHeight
if actor.get_width() != actor.get_stage().get_width():
storedWidth = actor.get_width()
storedHeight = actor.get_height()
width = actor.get_stage().get_width()
height = actor.get_stage().get_height()
else:
width = storedWidth
height = storedHeight
actor.animatev(Clutter.AnimationMode.EASE_OUT_BOUNCE,
500, ["width", "height"], [width, height])
GtkClutter.init([])
bttn = Gtk.Button("Foobar")
txtv = Gtk.TextView()
scwn = Gtk.ScrolledWindow()
scwn.add(txtv)
scwn.show_all()
bact = GtkClutter.Actor(contents = scwn)
embd = GtkClutter.Embed()
stge = embd.get_stage()
col = Clutter.Color()
col.from_string("#000")
stge.set_color(col)
vbox = Gtk.VBox()
wndw = Gtk.Window(width_request = 400, height_request = 300)
stge.add_actor(bact)
vbox.pack_start(embd, True, True, 0)
vbox.pack_start(bttn, False, True, 0)
wndw.add(vbox)
wndw.show_all()
bttn.connect("clicked", on_clicked, bact)
wndw.connect("destroy", lambda w: Gtk.main_quit())
Gtk.main()
from gi.repository import Gtk, Clutter, GtkClutter
storedWidth = 0
storedHeight = 0
def on_clicked(b, actor):
global storedWidth, storedHeight
if actor.get_width() != actor.get_stage().get_width():
storedWidth = actor.get_width()
storedHeight = actor.get_height()
width = actor.get_stage().get_width()
height = actor.get_stage().get_height()
else:
width = storedWidth
height = storedHeight
actor.animatev(Clutter.AnimationMode.EASE_OUT_BOUNCE,
500, ["width", "height"], [width, height])
GtkClutter.init([])
bttn = Gtk.Button("Foobar")
txtv = Gtk.TextView()
scwn = Gtk.ScrolledWindow()
scwn.add(txtv)
scwn.show_all()
bact = GtkClutter.Actor(contents = scwn)
embd = GtkClutter.Embed()
stge = embd.get_stage()
col = Clutter.Color()
col.from_string("#000")
stge.set_color(col)
vbox = Gtk.VBox()
wndw = Gtk.Window(width_request = 400, height_request = 300)
stge.add_actor(bact)
vbox.pack_start(embd, True, True, 0)
vbox.pack_start(bttn, False, True, 0)
wndw.add(vbox)
wndw.show_all()
bttn.connect("clicked", on_clicked, bact)
wndw.connect("destroy", lambda w: Gtk.main_quit())
Gtk.main()
No comments:
Post a Comment