OnExit() + custom mainloop

nitrogenycs@web.de wrote:

Hello,

i got a problem with wxPython (both, 2.4.2 and 2.5.3) + custom mainloop.
What i do so far is derive my app from wx.App, then do the while-pending-messages-dispatch-them-call-idle-processing-afterwards thing. It all works fine, but i can't catch when the application ends (that is when i closed the main window). I've added the OnExit() function to my App class but obviously this doesn't ever get called.
The code i use is very similar to this one: http://nebuladevice.sourceforge.net/cgi-bin/twiki/view/Nebula/UsingBoa#Step_4_Adding_Nebula_to_App . OnExit() never gets called so the mainloop will loop forever instead of stopping when due.
What am i doing wrong? I am quite new to wxPython so i might have overlooked some important caveat. Did i miss to tell wxPython to call OnExit(), is the whole concept flawed or is this a bug?

When using the stock MainLoop OnExit is called after the main loop exits and before the MainLoop function returns. Since you are doing your own MainLoop then it's not going to happen. You need to have your own mechanism for determining when to exit. See samples/mainloop/mainloop.py for an exampple.

ยทยทยท

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