[wxpython-users] destroy that window, NOW!
Paul McNett
p at ulmcnett.com
Tue May 6 11:36:31 PDT 2008
raffaello wrote:
> This problem arises with secondary frames, opened on the fly, closed and
> then reopened: I get this kind of message error:
> File "C:\Python_programs\Conti correnti\buildconti\out1.pyz/wx._core",
> line 14318, in __getattr__
> wx._core.PyDeadObjectError: The C++ part of the StaticText object has
> been deleted, attribute access no longer allowed.
>
> My workaround so far has been to MOVE the secondary frame to
> wx.Point(-10000, -10000): it works and is very fast, but obviously no
> memory is released.
It sounds to me like you actually want to hide the secondary frame, not
destroy it, so that the second time the user opens it it is already
defined. But, the user closes the frame which destroys it automatically,
but not immediately.
So, catch EVT_CLOSE and veto the close, and call frame.Hide() instead.
Then when you want to open it again, call frame.Show(). I don't think
there's any need to move the frame offscreen.
Paul
More information about the wxpython-users
mailing list