destroy(n) Tk Built-In Commands destroy(n)


destroy - Destroy one or more windows

destroy ?window window ...?


This command deletes the windows given by the window arguments, plus all of their descendants. If a window “.” is deleted then all windows will be destroyed and the application will (normally) exit. The windows are destroyed in order, and if an error occurs in destroying a window the command aborts without destroying the remaining windows. No error is returned if window does not exist.

Destroy all checkbuttons that are direct children of the given widget:

proc killCheckbuttonChildren {parent} {
   foreach w [winfo children $parent] {
      if {[winfo class $w] eq "Checkbutton"} {
         destroy $w
      }
   }
}

application, destroy, window

Tk