Avoiding MainLoop

I'm writing a program in which I'd like to use a wxPython GUI. The GUI, however, is just for configuration and it isn't a GUI-centric program. I would like to avoid turning over total control to app.MainLoop() because my program already has its own main loop for handling other types of events. Is there any way to perform the functions of app.MainLoop() from my own code? I tried the following, which I thought was the escense of app.MainLoop(), without success:

while (1):
  while (not app.Pending()):
    app.ProcessIdle()
  while (app.Pending()):
    app.Dispatch()

Please reply to me directly as I'm not currently subscribed to the mailing list.

Ben Buchwald wrote:

I'm writing a program in which I'd like to use a wxPython GUI. The GUI, however, is just for configuration and it isn't a GUI-centric program. I would like to avoid turning over total control to app.MainLoop() because my program already has its own main loop for handling other types of events. Is there any way to perform the functions of app.MainLoop() from my own code? I tried the following, which I thought was the escense of app.MainLoop(), without success:

while (1):
    while (not app.Pending()):
        app.ProcessIdle()
    while (app.Pending()):
        app.Dispatch()

The guts of the mainloop have been factored out of the wx.App class and so the way to do it now is to create an instance of wx.EventLoop. For an example see: http://cvs.wxwidgets.org/viewcvs.cgi/wxWidgets/wxPython/samples/mainloop/

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!