Kevin Altis wrote:
My apologies if this is old news to you and I'm misunderstanding your
problem. This should still be useful for everyone else that doesn't
know about "idle".
You completely missed my point
I know exactly what an idle handler
is and have been using them for several years. Here is a simpler
illustration of the problem:
Lets say you have an idle handler that looks like this:
def OnIdle(self, _):
wx.BeginBusyCursor()
... do something ...
wx.EndBusyCursor()
On Linux, what actually happens is that the call to wx.BeginBusyCursor
causes the idle handler to be recursively invoked, which calls
wx.BeginBusyCursor which causes the idle handler to be invoked which
calls wx.BeginBusyCursor which causes the idle handler to be invoked
which calls wx.BeginBusyCursor which causes the idle handler ......
Here is some code that shows the problem:
On Windows, the idledepth is only ever 1 (ie the idle handler is
not called recursively). On Linux it is called recursively
and you will get infinite recursion. On top of that, you get a
stack trace that gives no actual clue to what the problem
is (for real code anyway, this code does sort of a give a clue)
路路路
==================================================================
import wx
class MyFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, "dummy")
wx.EVT_IDLE(self, self.OnIdle)
self.idledepth=0
def OnIdle(self, _):
self.idledepth+=1
wx.BeginBusyCursor(wx.StockCursor(wx.CURSOR_ARROWWAIT))
print "doing something in idle",self.idledepth
wx.EndBusyCursor()
self.idledepth-=1
app=wx.PySimpleApp()
f=MyFrame()
f.Show(True)
app.MainLoop()
==================================================================
Roger