[wxPython-users] __del__ not called ?
Stef Mientki
s.mientki at ru.nl
Fri Feb 1 11:51:57 PST 2008
hi Robin,
Robin Dunn wrote:
> Stef Mientki wrote:
>
> If you haven't already read it, here is some background info on
> __del__: http://effbot.org/pyref/__del__.htm
Yes I've read that, but can't oversee all it's consequences,
what I picked up from it, is that it might be tricky doing things in a
__del__ function.
>
>> hello,
>>
>> I've a class, derived from object,
>> that consists of several graphical objects,
>> and some interface with an external program.
>> Now I have to kill the external program when my program finishes.
>> And example of the object is given below.
>>
>> In the standalone application, where the class instance was dropped
>> straight on a miniframe,
>> I already discovered that closing the miniframe, didn't always
>> generate an onclose event,
>> so I found out that in this case the __del__ function worked always
>> correctly.
>
> They're not quite the same thing though. The EVT_CLOSE event will
> happen before the window is actually destroyed and will give you a
> chance to prevent it from doing so. The __del__ will happen after the
> window is destroyed, when the Python proxy object is being cleaned up.
>
> BTW, can you provide a sample that shows the miniframe not getting the
> EVT_CLOSE?
Sorry, I can't reproduce it,
so I guess it happened while there were still some bugs in the program.
So I removed the __del__, as there seems to be all kinds of tricky
things in it.
And your suggestion the AUI panes might have some strange behavior in
case hiding instead of destroy ,
led to a solution in which I call an explicit Kill action to all
controls on an AUI pane,
before "destroying" an AUI pane,
This seems to work great.
thanks,
Stef
More information about the wxpython-users
mailing list