destroy
Guide: Frames, labels, and buttons
Deletes widgets, with each of their descendants and their widget commands.
destroy ?WINDOW ...?
Description
Deletes each WINDOW in the order of the call. The descendants of a widget go with it, and the command of each widget is deleted. The widget leaves its geometry manager, and the layout of its container changes. A <Destroy> binding runs for each deleted widget.
A name of a widget that does not exist gives no error, so a script can call destroy on a widget that is already gone. destroy . deletes the main window and ends the application.
Returns
An empty string.
Examples
# The child goes with its parent.
% frame .a
> frame .a.b
> destroy .a
> list [winfo exists .a] [winfo exists .a.b]
0 0
# The widget command is gone.
% button .ok
> destroy .ok
> info commands .ok
# A widget that does not exist gives no error.
% frame .c
> destroy .c .nope
> destroy .c
% frame .e
> frame .e.f
> bind .e <Destroy> {lappend ::gone %W}
> destroy .e
> set gone
.e
% destroy
Errors
A name that is not a widget, or no name, gives no error.
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztk 1.0.0-beta.1