[Tutor] Tkinter threads

Phil phillor9 at gmail.com
Tue Mar 8 18:17:26 EST 2022


On 8/3/22 19:36, Peter Otten wrote:

> If you have a loop like
>
> while some_condition:
>     do_stuff()
>     sleep(delay_in_seconds)
>
> you don't have to put it into a separate thread.
> Replace sleep() with Tk.after() instead:

Thank you Peter,

My game of life project is written for wxpython rather than tkinter. I 
use wxpython's time event to do the cell generation calculations which 
is intense enough to cause my old laptop to run hot fairly quickly and 
the GUI to become sluggish. I use the GUI to select different seed 
patterns and adjust the speed of cell generation while it's running.

I've used threads in C++ and so I thought that would be the answer under 
tkinter but... It's not something that occupies much of my time, I was 
just wondering.

-- 

Regards,
Phil



More information about the Tutor mailing list