[Tkinter-discuss] Forcing a window to update with while loop running

Tim Jones timj at tolisgroup.com
Thu Jun 18 23:15:45 CEST 2009


On Jun 18, 2009, at 1:34 PM, Adam Kadzban wrote:

> ...
> loop = 1
> ...
> (create a button that sets loop to 0)
> ...
top.update() <<--- Remove
> ...
> while loop:
   top.update() <<--- Remove
>   ...do stuff...
>   top.update()

The result here is that the UI will update on each iteration of the  
loop.  I believe that you'll find the two removed calls are really  
not necessary since the result in the loop is to call update() at the  
bottom of the loop and then immediately again at the entry to the loop.

Or, place your actual loop code in a thread which allows the top  
event loop to stay responsive.

HTH,
Tim



More information about the Tkinter-discuss mailing list