How should you go about catching exceptions and displaying them in a dialog box? I have seen the error windows in the demo, but I would like to make my own to handle my own custom exceptions. How can the user choose to quit or continue?
I have used a try ... except struct in my __main__ function, but this does not seem to catch the error when wxPython is running.
Any suggestions?
James Shaw
···
_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com
See ErrorDialogs in new features of the last wxPython demo.
HTH,
Frank
James Shaw wrote:
···
How should you go about catching exceptions and displaying them in a dialog
box? I have seen the error windows in the demo, but I would like to make my
own to handle my own custom exceptions. How can the user choose to quit or
continue?
I have used a try ... except struct in my __main__ function, but this does
not seem to catch the error when wxPython is running.
Any suggestions?
James Shaw
_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com
How should you go about catching exceptions and displaying them in a
dialog
box? I have seen the error windows in the demo, but I would like to make
my
own to handle my own custom exceptions.
The code that calls event handlers and callbacks will check for an exception
and print it if there is one, and then clears the error. This seemed to
make more sense than trying to propogate the exception back in and out of
Python and C++ code an unknown number of times until it gets back to
__main__.
How can the user choose to quit or
continue?
A dialog?
wxGetApp().ExitMainLoop() should exit the program in a sane way.
I've already seen the ErrorDialog in the wxPython demo, as I mentioned in
my
previous post. I have looked at the source, but find it very difficult to
understand. If someone could explain how to intercept sys.stderr to
create
your own exception handlers, I would be very grateful.
If all you want is to catch stderr look in wx.py at wxPyOnDemandOutputWindow
for an example.
···
--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters? http://wxPython.org Relax with wxPython!