Is it normal to have a python process hanging after a Frame has been closed?
I am using an xrc file to create the Frame, and load it. When I close
the Frame, it disappears, but a python (or pythonw25) process keeps
running for a while before (sometimes) crashing.
I have heard that there can be runtime errors when a sizer is added to a
sizer (which I am doing) but “WxPython In Action” seems to indicate that
this is not a problem.
I’ve attached the code FrameClose.xrc and FrameClose.py (Python 2.5.1,
WxPython 2.8.7.1 on Windows XP)
Is it normal to have a python process hanging after a Frame has been closed?
I am using an xrc file to create the Frame, and load it. When I close
the Frame, it disappears, but a python (or pythonw25) process keeps
running for a while before (sometimes) crashing.
I have heard that there can be runtime errors when a sizer is added to a
sizer (which I am doing) but "WxPython In Action" seems to indicate that
this is not a problem.
You are essentially creating the frame twice, once when you call wx.Frame.__init__ and once when you call LoadOnFrame. Since there is an extra frame still existing then the app's main loop doesn't exit.
The proper way to use XRC in this example is to use the 2-phase create pattern. Basically you create the instance of the object first, and then let the UI object be created by XRC later, like in the attached.