Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cancelling a window 1

Status
Not open for further replies.

WaltS

Programmer
Mar 11, 2002
13
US
What is the proper way to cancel a window so I do not get the error 'command ".window" already exists in namespace"::" ' if I try to open it again later?
 
By "cancelling" a window, I assume you mean "destroy" it? The destroy command completely destroys one or more widgets. It also destroys any children of that widget (for example, other widgets managed by a frame). As you've seen, Tcl requires all widgets to have unique names, so it's an error to create a widget with the name of an existing widget.

By the way, if you've got a widget or toplevel window that you want to display and hide repeatedly in a program, you don't have to destroy it; you can instead temporarily hide it. The pack forget and grid forget commands remove from the screen a widget previously packed or gridded. You can then pack or grid them again later without having to recreate them from scratch. And for a toplevel window, you can use wm withdraw to hide it and wm deiconify to redisplay it. - Ken Jones, President
Avia Training and Consulting
866-TCL-HELP (866-825-4357) US Toll free
415-643-8692 Voice
415-643-8697 Fax
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top