I did not want to use a timer; ideally, it should have been called
within the main wx application loop (MainLoop()).
Trouble is, MainLoop() only returns when you quit the application, so
I had to replicate the MainLoop functionnality and insert the PyRO
service loop call within.
After some trial-and-error, I found that the following will do:
Run=1
while Run:
app.Yield()
app.ProcessIdle()
daemon.handleRequests(0)
("Yield". What an obvious method name for what it does - no wonder I
had to use trial and error...).
Of course, if anyone sees any pitfalls and has the proverbial "better
way to do it", I'm all ears.
Using Yield in this way will result in an error if any of the event
handlers also need to call Yield (because nested yields are not allowed.)
Instead you can override MainLoop with your own implementation as shown
in samples/mainloop/mainloop.py or you can decouple things a bit more
and run your PyRO daemon in another thread, using wx.CallAfter or some
other means to safely pass info back to the GUI thread.
--
Robin Dunn
Software Craftsman
http://wxPython.org