Grid not getting updated

G

Gensek

I have a wxPython program, and it has a loop. I want to be able to
break the loop by pushing a button. But it doesn't react to events
until the loop finishes, which is sort of pointless.

What's the best way to get it to work? Do I need threads? Or is there a
more convenient way?
 
S

Steve Holden

Gensek said:
I have a wxPython program, and it has a loop. I want to be able to
break the loop by pushing a button. But it doesn't react to events
until the loop finishes, which is sort of pointless.

What's the best way to get it to work? Do I need threads? Or is there a
more convenient way?
You should call the application's Yield() method now and again inside
your loop. This allows the window display system to catch up with the
changes to data structures that your algorithms make (I know it looks
like the methods you call change the windows, but that actually happens
separately), and when Yield() returns the window display should be fully
up to date.

regards
Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,222
Messages
2,571,137
Members
47,753
Latest member
LilianMcIl

Latest Threads

Top