Frame Close leaves python.exe hanging?

Hello

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)

Any pointers would be appreciated, thanks!

Abi

FrameClose.py (626 Bytes)

FrameClose.xrc (7.26 KB)

you can use this.

def OnExit(self, evt):
wx.Exit()

···

2008/6/20, list mail listismail@gmail.com:

Hello

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)

Any pointers would be appreciated, thanks!

Abi


wxpython-users mailing list
wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

list mail wrote:

Hello

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.

FrameClose.py (670 Bytes)

···

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