tkinter redraw rates

Peter Otten __peter__ at web.de
Wed Jul 17 20:10:31 CEST 2013


fronagzen at gmail.com wrote:

> Hm. My apologies for not being very clear. What I'm doing is this:
> 
>         self.loader_thread = Thread(target=self.loadpages,
>                                     name="loader_thread")
>         self.loader_thread.start()
>         while self.loader_thread.isAlive():
>             self.root_window.update()
>             sleep(0.05)
> 
> Where loadpages is a function defined elsewhere.

I suppose the while loop runs in the main thread? That's not a good idea 
with Tkinter (and GUIs in general). I suggest using

http://effbot.org/zone/tkinter-threads.htm

as a template. The main difference is that instead of your while-loop and 
sleep() it calls the after() method which keeps tkinter in control so that 
it can still respond to events.




More information about the Python-list mailing list