Grid not getting updated

Steve Holden steve at holdenweb.com
Thu Mar 3 14:00:41 EST 2005


Gensek wrote:
> 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
-- 
Meet the Python developers and your c.l.py favorites March 23-25
Come to PyCon DC 2005                      http://www.pycon.org/
Steve Holden                           http://www.holdenweb.com/



More information about the Python-list mailing list