problems with tkinter updates

yves at yves at
Tue Jan 24 01:47:32 EST 2012

On 2012-01-23 20:57, Dave Angel wrote:
> You have it backward. The question is not what you do inside your loop to give
> tk a chance, but rather what do you do to make tk give you a chance. tk
> doesn't "start" till you make the mainloop() method call, and once you call
> that method, it won't return till the program is exiting.
> So, forget about input statements inside some loop. Input isn't a gui concept,
> it's for console apps. Gui apps use dialog boxes and such. Similarly sleep().
> mainloop() will sleep, when there are no events in its queue. If you want to
> do work, break it into manageable chunks, and attach each chunk to some event
> that tk will fire.

The input statements were there for debugging purpose... I now have got it 
running without any sleep or input, I simply added a tk.update() in the loop. 
It works for updating the window, but when I add buttons to that frame, they 
are quite unresponsive. I'm starting to think I need to split off the reading 
part into a different thread.


More information about the Python-list mailing list