[Tutor] Tkinter mainloop()

Francesco Loffredo ilcomputertrasparente at gmail.com
Tue Jul 6 18:02:24 CEST 2010


Il 06/07/2010 17.32, Alan Gauld wrote:
>
> "Francesco Loffredo" <ilcomputertrasparente at gmail.com> wrote
>
>> How can I ask a Canvas to redraw itself at my command? And if i can't,
>> when should I call the auto move?
>
> You can ask the canvas to repaint itself by calling update_idle_tasks()
> method.
Thank you, Alan. As many answers, this poses me a new question: why 
should I call update_idle_tasks() instead of update() ? What's the 
difference between the two methods?

> But in general you shouldn't need to. It's usually better to keep
> your event handlers short enough that they return to the mainloop which
> will then redraw as necessary for you.
In general, I do agree. But I explained rather verbosely the peculiar 
situation I'm facing in my practice project: where would you put the 
automatic move call, if not where I did? I need an automatic move be 
performed at the proper moment, when it's the computer player turn.

> HTH,
   SID!  (sure it did!)


More information about the Tutor mailing list