[wxPython-users] how to execute code in MainLoop ?

Christopher Barker Chris.Barker at noaa.gov
Thu May 31 15:42:11 PDT 2007


Stef Mientki wrote:
> You're right, 2 times a second is fast enough for me (I might even be 
> older ;-).
> But my calculations (certainly if my model gets detailed), are very very 
> slow in Python,
> so I need all the time I can get for calculations.

If you can do your calculations one time step at a time, It'd be easy to 
have a loop like:

while TerminationCritera:
     Model.CalcNextTimestep
     Visualization.Draw()


and there you go.

You might want a wx.App.Yield() in there too, so that someone could push 
a "Stop" button or something.

By the way, I don't what you want to visualize, but there is a good 
chance that wx.lib.floatcanvas could help with that part.

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov




More information about the wxpython-users mailing list