No -- you will have to do an explicit top.delete() in the function.
In the next version (which will keep a map of children) this will be
even truer. In Python, garbage collection can often not be trusted to
do the right thing -- there are too many ways a pointer to a frame can
end up in a stack trace (e.g. sys.exc_traceback and
Note that deleting the top of a widget tree, in Python as in Tcl, will
delete all subordinate widgets (to answer an earlier question).
--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>