__del__ not called ?
Stef Mientki
s.mientki at ru.nl
Fri Feb 1 08:01:38 PST 2008
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.
Now if I hang this class instance in my larger program,
where all instances are generated dynamically and
are placed on an AUI-panel (alone of together with other objects),
the __del__ function is never called.
Why is the __del__ function not called ?
Is there a more reliable solution ?
thanks,
Stef
class AD_Converter ( object ) :
def __init__ ( self, Dock ) # the frame/panel/... where we can put
self.Button_Start = wx.Button ( Dock, -1)
self.Button_Start.Bind ( wx.EVT_BUTTON, self.OnStart,
self.Button_Start )
def OnStart ( self, event ) :
.. if external program not yet exists, launch it
.. if external program is running, stop it (don't kill it)
.. else start it (again)
def __del__ ( self ) :
.. if external program exists, kill it
More information about the wxpython-users
mailing list