Hello everyone.
I’m rather new to wx python, though not to python itself.
I’m using wx to create a typical options dialog, using wx.Notebook inside a subclassed wx.Dialog, and I get a crash when closing my application after using the dialog.
I am running windows 7 64 bit, wx python version ‘3.0.2.0 msw (classic)’, python 2.7.10.
The attached code example explains more, but basically, I’m instantiating an instance of my custom dialog, showing it with ‘ShowModal’, and calling EndModal with the respective code (wx.ID_OK, wx.ID_CANCEL), in either the ok or cancel event handlers inside the dialog.
The trouble happens when I exit my application after having opened and closed this dialog - I believe that, for some reason, wx is calling ‘Destroy’ on it, and this is causing it to crash. If I run the application without opening the dialog, it exits just fine.
By crash, I don’t mean a nice pythonic exception - it’s presumably a C error, because the executable (python.exe) freezes and windows helpfully tells me it crashed and offers to send the error off to Microsoft.
I’m assuming that the ‘Destroy’ method is what’s causing the app to crash because I can reproduce it exactly by calling Destroy on my dialog at any time (from an event handler inside the dialog, from outside after ‘ShowModal’ returns, etc).
I have tried changing the parent of my dialog, commented out just about everything inside it at one time or another, destroying it’s main panel before calling EndModal… Nothing works, it still ccrashes.
I’ve attached a simplified example of my dialog, as well as a frame to run it.
Any help is greatly appreciated, this is a very basic dialog and it bothers me that I can’t get it to work - examples I find online work just fine and I can’t pin down what I’m doing different.
Thanks in advance,
Blake Oliver
test_options.py (4.21 KB)