[wxPython-users] Better exception handling
Jorgen Bodde
jorgen.maillist at gmail.com
Fri Jun 29 10:31:30 PDT 2007
Robin, as you can see in my example I did that. I could not get any
redirection. Also if I try the example given on Windows (by Gre7g), it
works. I do get a window upon an error. I added the redirect = True
and tried;
------------------
import wx
class TestApp(wx.App):
def OnInit(self):
self.MainFrame = wx.Frame(None, -1, "Test Frame")
self.MainFrame.SetBackgroundColour(wx.WHITE)
wx.StaticText(self.MainFrame, -1, "Click me!", wx.Point(50, 30))
self.ErrButton = wx.Button(self.MainFrame, -1, "Error",
wx.Point(50, 50))
self.ErrButton.Bind(wx.EVT_BUTTON, self.OnErr)
self.MainFrame.Show()
return True
def OnErr(self, Event):
1/0
App = TestApp(0, redirect = True)
App.MainLoop()
--------------
And I get the error:
Traceback (most recent call last):
File "test.py", line 15, in <module>
App = TestApp(0, redirect = True)
TypeError: __init__() got multiple values for keyword argument 'redirect'
So I just add 0, True instead of the keyword, and still no luck. I get
again in the console window:
jorg at shale:~/Desktop$ python test.py
Traceback (most recent call last):
File "test.py", line 13, in OnErr
1/0
ZeroDivisionError: integer division or modulo by zero
----------
What do I need to do more to get the redirect window on wxGTK, Ubuntu Feisty?
Can someone comfirm the above test app that it shows a redirect
window? It does not work for me..
Regards,
- Jorgen
More information about the wxpython-users
mailing list