Wxpython hangs up with no error message

Dear colleagues,
I did my first steps successfully to develop a small wxpython-app. Just one window that opens with 4 labels, input fields, buttons.
The strange thing is, that after a few times of testing my new code the console hangs up and the new window does not appear.
So, what I mean is, I develop in Spyder-IDE and on the right side I have the “console” where you can “print” out some additional checkes for testing and when you close the application --> then the console returns back to the “prompt”. And this does not happen after starting the app for maybe 6,7,8 times.
Then I have to “restart kernel” and then I can continue to develop.
I di not have this situation when devlopping with tkinter or other things, so I assume there is a relation to wxpython, but how can I capture kernel message or maybe kernel debug messages. At the moment the console does nothing and also shows no error message.
Thanks for your help
Best regards

You can’t run wx.App several time. You always need to re-start.
Usually IDEs offer to start a new process on every (debug) start.


Maybe I did not explain correctly.
Of course I always close the application and adapt some code and then I start again. I do not run wx.app several times in parallel
Best regards Eduardo

Your description indicates that you’re running wx.App several times in a series. Just don’t do that. A new process is required for each run. “restart kernel” every time before you run wx.App.

Hi Dietmar,
thank you for your feedback.
So you mean after closing the app (click the cross (X)on the right top side of the window) I have to restart the kernel before I open it again.
This is interesting I thought that when I close the app all classes/ memory will be destroyed.

Do you have some more information about that? Is this behaviour also normal for other modules like tkinter?
When I compile an exe file out of the py file and run and close this exe file --> this should work right?

Thanks for your help.


You can’t rely on this. E.g loaded and initalized DLLs will not be unloaded.
Also, what happens e.g. if you insert someting into sys.path? It will not be reset unless you re-start the interpreter.

Yes. It might be depend on the library / toolkit whether this is a problem or not.

Yes. Almost any IDE will start a new process on debug / run. This is a reasonable behaviour. Nobody wants to hunt for moving targets.

Pythonwin, Spyder seem to behave differently.
Also, hold out for IDEs that run the target application in the same process as the IDE itself. Pythonwin is probably still doing so. I’m not sure about IDLE, which also behaved like this in the past.

Proper IDEs/Debuggers don’t install themselves into the target system and they run the debug process separately from the IDE.