Hi wxPy folks,
I’m building a fresh version of vpython-wx on a mac. FYI it uses a “manual” main loop so that it can do 3D rendering periodically.
The main part of the loop is given below. I see there is some mac specific code here. It’s mostly black magic to me unfortunately (at least at this point).
while not _evtloop.Pending() and _evtloop.ProcessIdle(): pass
if _wx.GetApp(): _wx.GetApp().ProcessPendingEvents()
if _isMac and not _evtloop.Dispatch(): return
Currently on wxOSX Pending always returns true, so the
ProcessIdle above is not ever called. Call it here instead.
if _isMac: _evtloop.ProcessIdle()
while True:
checkAgain = False
if _wx.GetApp() and _wx.GetApp().HasPendingEvents():
_wx.GetApp().ProcessPendingEvents()
checkAgain = True
if not _isMac and _evtloop.Pending():
_evtloop.Dispatch()
checkAgain = True
if not checkAgain:
break
Now, the trouble is that on wxPython 3.0.0 _evtloop.Dispatch() seems to return quickly even when “nothing” is happening, but on 3.02 and 3.0.1 it’s slow. It only returns quickly if I’m moving the mouse or pressing the keys on the keyboard. Strange! Any idea why that might be? The earlier behavior is highly preferred!
thanks,
-steve