Charles Hartman wrote: > It occurs to me that if you added an OnExit() handler to your app -- > any app that's giving quit-too-soon trouble. The handler could simply > put up a wx.MessageBox, which gets an OK from the user. This would > pause the app on the way out, and therefore permit the normal app > output window (without changing redirection) to stay onscreen as long > as one liked. A little baroque, but pretty easy. > > Charles Hartman
I think I've found the right circumstances in which getting Traceback works. I tried what you said above, but it didn't work, although I did get the code to work by providing more path info. Below is the App portion of the code (the hello.py example 3 in the book Chap.1). I get the code to work now so long as I have the full path to the graphic image. If I make an error in the path, the app exits (as it should, I would guess). The OnExit is not invoked if there is an error. Here are the circumstances in which it is invoked or not (I tried to put this in a logical order) : (1) __init__ (and hence, wx.App.__init__) are not called (both commented out) (a) path is wrong, error NO OnExit (b) path is right, no error NO OnExit (2) __init__ (and hence, wx.App.__init__) are both called as shown below (a) redirect= True (i) path is wrong NO OnExit , but output is in external file (ii) path is right YES OnExit , and output is in external file (b) redirect= False (i) path is wrong NO OnExit , but output is to Terminal with traceback (!) (ii) path is right YES OnExit, and output is to Terminal Bottom line: OnExit is only invoked if the program runs without error. If you want the traceback you have to include a call to wx.App.__init__ and set the type of redirect you want. Note that redirect to the Terminal works fine then and the whole Traceback appears as one would like. A good hint for newbies like me. App portion of my code: class App(wx.App): """Application Class;""" def __init__(self): wx.App.__init__(self,redirect=True, filename="/Users/louispecora/Desktop/Hello.out") def OnInit(self): print "***here" image=wx.Image('/Users/louispecora/Code/python/test_folder/wxPython_learn/rappin_cover150.jpg', wx.BITMAP_TYPE_JPEG) self.frame = Frame(image) self.frame.Show() self.SetTopWindow(self.frame) return True def OnExit(self): print "In OnExit()" retCode=wx.MessageBox("Quit?", caption="Message on Quit.") -- Cheers, Lou Pecora Code 6362 Naval Research Lab Washington, DC 20375 USA Ph: +202-767-6002 email: [EMAIL PROTECTED] _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig