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

Stef Mientki S.Mientki at ru.nl
Fri Jun 1 02:47:02 PDT 2007



Christopher Barker wrote:
> 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()
>
Yes, I think that's the way I'll go
>
> and there you go.
>
> You might want a wx.App.Yield() in there too, so that someone could 
> push a "Stop" button or something.
I read it's very dangeruous
>
> 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.
At first I didn't want to visualize anything,
but as this my first change to use a Python GUI
(until now I always do my GUI in Delphi, which is much easier ;-),
I'm thinking of: LEDs turning on and off, LCD-displays etc.
Besides that I want to use a editor component, where the actual executed 
code line is highlighted.

I've chozen OGL, after looking at the wxPython demos (really beautiful 
demo !!),
and for as far as I can judge it's quit similar to FLOATCANVAS.
Anyway thanks for the tip.

cheers,
Stef Mientki


>
> -Chris
>
>
>

Kamer van Koophandel - handelsregister 41055629  / Netherlands Chamber of Commerce - trade register 41055629






More information about the wxpython-users mailing list