[Tkinter-discuss] after and after_idle

Geoff Bache geoff.bache at gmail.com
Wed May 19 21:27:06 CEST 2010


>                        .
> I quote two Masters of Tk:
>
>    Idles run until the idle queue is drained.  If
>    an [after idle] reschedules itself endlessly, it
>    hangs the event loop.  [after idle [after 0 ...]]
>    causes the idle to schedule a timer event that's
>    immediately ready, so the rescheduled callback is
>    NOT an idle event and the event loop can make
>    progress.
>
>    idle events are critical to doing a good job of a
>    GUI; [I have] no idea if they are useful for
>    anything else ...
>
> One of us needs to write this in readable English.  I know *I* am already
> backed up ...

OK. It would help me if the example was in readable Python for a start...

Am I right in thinking it would translate as

root.after_idle(foo)

def foo():
     .....
     root.after(0, foo)

In this case I'm even more confused. What's the point of it being an
"idle event"
the first time but never thereafter? Wouldn't it be equivalent to also
add it the
same way the first time?

Thanks,
Geoff


More information about the Tkinter-discuss mailing list