[Tutor] Making a function run every second.
Wayne Werner
waynejwerner at gmail.com
Tue Nov 29 17:22:56 CET 2011
On Tue, Nov 29, 2011 at 10:09 AM, Dave Angel <d at davea.name> wrote:
> <snip>tkinter provides a couple of specific timer events, and I now see
> your reply to a message that said to use the after() method, which is a
> one-shot. I believe there's another one that sets a periodic timer so you
> don't have to do an after() call each time it fires.
>
Not in Tkinter - you have to do what Peter Otten suggested:
> For a script that uses tkinter there's the after() method.
> Example:
> root = Tk()
> def hi():
> print("ho")
> def hi_reschedule():
> hi()
> # make tkinter call it again after 1000 milliseconds
> root.after(1000, hi_reschedule)
> hi_reschedule() # call it manually the first time
HTH,
Wayne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20111129/018b1d49/attachment.html>
More information about the Tutor
mailing list