Timer in Tkinter?

moonlite56 at yahoo.com moonlite56 at yahoo.com
Fri Aug 17 05:31:45 CEST 2001

The after method works, but it only updates once. Is there a way for 
it to keep running continously, so that the pet updates over and 
over again?


Yes, there is. Use the after method:

>>> from Tkinter import *
>>> def printSomething():
...   print "wibble"
>>> root=Tk()
>>> root.after(2000,printSomething)
>>> 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 
about Tkinter, I recommend Fredrik Lundh's excellent An Introduction
to Tkinter. It's at:


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

More information about the Python-list mailing list