TKinter Destroy Question

Rob talon2lm at yahoo.com
Wed Nov 19 23:59:06 EST 2003


My first GUI so be gentle...

When I start my program I call a class that runs the initial window. While
in this class if a certain button is pressed it calls a function outside the
class. This function then initially calls another function to
"root.destroy()". Basically I want the current window gone so the function I
just called can open it's own window. The problem I'm stuck with is that
once this function is done and I need to close the new window to go to the
next window i again call the function which performs the "root.destroy()".
When I try to call it a second time it tells me:

TclError: can't invoke "destroy" command:  application has been destroyed

How can it already be destroyed if I opened a new window in my function?
Should I slip in somewhere a new "root.mainloop()" statment? It seems when I
try this I get some weird results (Every command after the new
root.mainloop() nothing happens, no buttons drawn, nothing). Is there an
easier way to clear windows than to use the root.destroy? I've basically run
into a nice brick wall...

Thanks for the help!
Rob






More information about the Python-list mailing list