[wxPython] Simple questions

Ok, here goes (should work on Linux/Windows):

1- What is the signal to catch for Destroy? The one when you click on destroy_window

2- Why doesn’t all my app windows get deleted when I close the main window? How do I do a full exit, do I need to emit a destroy signal? Does it matter if second window is also a wxApp?

3- Is there away to redirect all errors (python/wx/whatever) to a pop-up dialogs?

Thanks

Ok, here goes (should work on Linux/Windows):

1- What is the signal to catch for Destroy? The one when you click on
destroy_window

EVT_CLOSE(win, func)

2- Why doesn't all my app windows get deleted when I close the main
window? How do I do a full exit, do I need to emit a destroy signal?
Does it matter if second window is also a wxApp?

If the other windows are children of the main window, they should get
automatically closed. There should be only one wxApp.

3- Is there away to redirect all errors (python/wx/whatever) to a pop-up
dialogs?

Wrap your entire program in a try: except: clause like so:

from wxPython.wx import *
import sys, traceback
from StringIO import StringIO

def main():
    try:
        wxBarf()
    except: # catch all exceptions
        msg = StringIO()
        traceback.print_exc(sys.exc_info()[2], msg)
        dlg = wxMessageDialog(None, msg.getvalue(), 'Error Message', wxOK |
wxICON_INFORMATION)
        dlg.ShowModal()
        dlg.Destroy()

app = wxPySimpleApp()
main()

···

On Tuesday 02 October 2001 10:53, Hassan Aurag wrote:

--
Cliff Wells
Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308
(800) 735-0555 x308

Pardon if this gets posted twice, I had an error during send and it looks
like it got lost...

Ok, here goes (should work on Linux/Windows):

1- What is the signal to catch for Destroy? The one when you click on
destroy_window

EVT_CLOSE(win, func)

2- Why doesn't all my app windows get deleted when I close the main
window? How do I do a full exit, do I need to emit a destroy signal?

If the windows are children of the main window, they should get closed when
the main window closes.

Does it matter if second window is also a wxApp?

There should be only one wxApp

3- Is there away to redirect all errors (python/wx/whatever) to a pop-up
dialogs?

from wxPython.wx import *
import sys, traceback
from StringIO import StringIO

def main():
    try:
        wxBarf()
    except: # catch all exceptions
        msg = StringIO()
        traceback.print_exc(sys.exc_info()[2], msg)
        dlg = wxMessageDialog(None, msg.getvalue(), 'Error Message', wxOK |
wxICON_INFORMATION)
        dlg.ShowModal()
        dlg.Destroy()

app = wxPySimpleApp()
main()

···

On Tuesday 02 October 2001 10:53, Hassan Aurag wrote:

--
Cliff Wells
Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308
(800) 735-0555 x308

> 3- Is there away to redirect all errors (python/wx/whatever) to a pop-up
> dialogs?

Take a look at the definition of wxApp in wx.py. It allows you to specify
in the constructor that Python's stdout and stderr will be redirected to a
window. Also, if you use the hybrid version of wxPython (on Win32) then
many of wxWindows errors will go to pop-up dialogs by default.

···

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

I've got some working code for this which I'll be submitting for inclusion
in wxPython/lib very shortly...

Chris

···

-------------------------------------------------------------------------
Chris Fama <mailto:Chris.Fama@whollysnakes.com>
         or <mailto:Chris.Fama@uq.net.au>
Brisbane, Australia
Phone: (0/+61)(7) 3870 5639 {10am-10pm GMT+10 on both these numbers please}
Mobile: (0/+61)(400) 833 700
-------------------------------------------------------------------------
Business page: <http://whollysnakes.com>
Personal page: <http://uq.net.au/~zzcfama&gt;
-------------------------------------------------------------------------

----- Original Message -----
From: "Robin Dunn" <robin@alldunn.com>
To: <wxpython-users@lists.wxwindows.org>
Sent: Wednesday, October 03, 2001 11:41 AM
Subject: Re: [wxPython] Simple questions

> > 3- Is there away to redirect all errors (python/wx/whatever) to a

pop-up

> > dialogs?
>

Take a look at the definition of wxApp in wx.py. It allows you to specify
in the constructor that Python's stdout and stderr will be redirected to a
window. Also, if you use the hybrid version of wxPython (on Win32) then
many of wxWindows errors will go to pop-up dialogs by default.

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

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users