467,923 Members | 1,157 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,923 developers. It's quick & easy.

porting from Tkinter to pygtk

I am in the process of learning pygtk and I would like to port
some custom made Tkinter widgets to pygtk, just an exercise.
For instance I have this code:

.. from Tkinter import *
..
.. class AnimatedLabel(Label):
.. def __init__(self, master, text, width=72, maxspc=16, deltat=100,
**kw):
.. self.text = text
.. self.width = width
.. self.maxspc = maxspc
.. self.deltat = deltat
.. self.stringvar = StringVar(master)
.. self.stringvar.set(text)
.. self.stop = False
.. Label.__init__(self, master, textvariable=self.stringvar,
**kw)
..
.. def startAnimation(self, spaces='', addspace=False):
.. if len(spaces) == 0 or len(spaces) == self.maxspc:
.. addspace = not addspace
.. if addspace: # add a space
.. spaces += ' '
.. else: # remove a space
.. spaces = spaces[1:]
.. if not self.stop: # repeat each 100 ms changing spaces and
addspace
..
self.stringvar.set(spaces.join(self.text).center(s elf.width))
.. self.after(self.deltat, self.startAnimation, spaces,
addspace)
..
.. def stopAnimation(self):
.. self.stop = True
..
..
.. if __name__ == "__main__":
.. t = Tk()
.. t.title('Example')
.. t.config(background='green')
..
.. a = AnimatedLabel(t, text="Hello", fg='blue', bg='green')
.. a.pack()
.. a.startAnimation()
.. t.mainloop()

what's the equivalent of the .after() method in pygtk?
BTW, is there any intro to pygtk thought for Tkinter users?
TIA,

Michele Simionato

Jul 18 '05 #1
  • viewed: 1052
Share:

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by srijit | last post: by
5 posts views Thread by carljohan.rehn | last post: by
reply views Thread by Sebastien Aubry | last post: by
reply views Thread by Sebastien Aubry | last post: by
8 posts views Thread by JyotiC | last post: by
2 posts views Thread by sandip desale | last post: by
4 posts views Thread by fabdeb | last post: by
reply views Thread by Michael Palmer | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.