tkinter destroy()

Eric Brunel eric_brunel at despammed.com
Tue Mar 29 07:42:29 EST 2005


On Tue, 29 Mar 2005 10:37:10 GMT, max(01)* <max2 at fisso.casa> wrote:
> hi people.
>
> when i create a widget, such as a toplevel window, and then i destroy
> it, how can i test that it has been destroyed? the problem is that even
> after it has been destroyed, the instance still exists and has a tkinter
> name, so testing for None is not feasible:
>
>  >>> import Tkinter
>  >>> fin = None
>  >>> fin1 = Tkinter.Toplevel()
>  >>> fin1.destroy()
>  >>> print fin1
> .1075951116

The winfo_exists method is what you want:

>>> print fin1.winfo_exists()
0

However, I'm curious about *why* you want to do that: since *you* made the call to destroy, what would you want to do anything with a widget you've already destroyed?

HTH
-- 
python -c 'print "".join([chr(154 - ord(c)) for c in "U(17zX(%,5.z^5(17l8(%,5.Z*(93-965$l7+-"])'



More information about the Python-list mailing list