__del__ in classes derived from Tkinter classes
Petr Klyushkin
petrk at pochtamt.ru
Fri Jul 19 07:12:34 EDT 2002
Hello, Fredrik!
>>>>> "Fredrik" == Fredrik Lundh writes:
Fredrik> Petr Klyushkin wrote
>> I'm a Python and Tkinter newbie. I've noticed that __del__
>> methods of my classes derived from Tkinter classes are never
>> called. Is this normal behavior, or I am doing something wrong?
[...]
Fredrik> tkinter maintains an internal widget tree. if you want to
Fredrik> print "hey" when your toplevel widget is destroyed, over-
Fredrik> ride the "destroy" method:
[...]
So, when will Python object be destroyed? Suppose, I have following code:
def f():
test2 = Test()
f()
When will test2 (Python object! not a Tk widget it represents) be destroyed?
Fredrik> (and using __del__ is usually bad style even outside
Fredrik> Tkinter, but that's another story).
Why?
--
C'ya, Peter.
--=[petrk at pochtamt.ru]=--=[http://petrk.pochtamt.ru]=--
--=[ICQ 89449080]=--=[Jabber dassburger at jabber.ru]=--
More information about the Python-list
mailing list