From: Kevin A. <al...@se...> - 2004-04-25 14:09:13
|
On Apr 25, 2004, at 3:35 AM, Arthur Elsenaar wrote: > Hi, > > I'm working my way through the tutorials and stumbled upon some issues > at walkthrough 3, timers and threads here: > > http://pythoncard.sourceforge.net/timers-threads.html > > Running the threads example, I got a time.sleep() unknown error that i > fixed by importing the time module (this should be added to the page). > Also when I run the thing, it's continuously spitting out idle events. > Is this supposed to happen, it seems very inefficient. In the code, > the thread is sleeping for 10 seconds and then an idle event is > generated by a wx.wxWakeUpIdle(). > > Hope someone has some answers for a newbie. > > Arthur > btw: running OS X 10.3.3 > I'll add the note about importing the time module when I update the document for release 0.8 unless David is going to do that. The problem with the idle events that you're seeing could be explained by the fact that on wxWidgets/wxPython the "idle" event really means the event queue just emptied. That means simply moving the mouse is going to result in an idle event after each mouseMove since the queue will empty. That is why the PythonCard Message Watcher doesn't have an option to display idle events. Anyway, for release 0.8 I'm seriously considering renaming the idle event to something that more accurately describes what the event really means like eventQueueEmpty, the problem being that that is very long name and everyone will misspell queue ;-) Perhaps noMoreEvents would be better but that isn't very accurate. I'm open to suggestions. For threading rather than using WakeUpIdle I think I will start recommending a change to using wxCallAfter and some user-defined event handler instead since that will have the same effect. When I look at updating the timers-threads.html document and the other samples that use WakeUpIdle I'll take a closer look at the alternatives. David McNab is still on the mailing list, so he might have some other comments to add. ka |