Timer in Tkinter?

moonlite56 at yahoo.com moonlite56 at yahoo.com
Thu Aug 16 22:52:23 EDT 2001


Thanks! I hadn't seen the after event there before. :)

--------------

Yes, there is. Use the after method:

>>> from Tkinter import *
>>> def printSomething():
...   print "wibble"
... 
>>> root=Tk()
>>> root.after(2000,printSomething)
'after#2'
>>> wibble

The first argument to after is the number of milliseconds to wait and
the second argument is the function to call. For information like 
this
about Tkinter, I recommend Fredrik Lundh's excellent An Introduction
to Tkinter. It's at:

http://www.pythonware.com/library/tkinter/introduction/index.htm

I almost always have a local copy open when I'm doing Tkinter
programming.






More information about the Python-list mailing list