The package wxPython is very good for developing GUI-interface applications in Python, but so far, the only methods that I have found to exit from an application developed in wxPython launched from the Python command line always generate a runtime error when the application is closed programmatically. For example, the method Frame.Destroy() generates the error:
Runtime error
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\PythonSamples\ArcGIS Examples\TIGER Data Loader.py", line 522, in
<module>
frame.Destroy()
RuntimeError: wrapped C/C++ object of type Frame has been deleted
A similar error message is generated if Frame.Close() is called. The only way that I have found to close an application window generated by wxPython WITHOUT generating a run-time error is by deleting the wx.App object:
app=wx.App()
frame = wx.Frame(etc....)
.
.
.
and somewhere in the program where you want to exit the Frame window, you issue
del app
This seems like a bad way to terminate an application. Is there a better way that does NOT generate a run-time error message?