shutdown main window tcl tk

class classname
{

public method shutdown
constructor { args } {}

}

body classname::constructor { args } {
 # Prevent killing of main window
 wm protocol [winfo toplevel $itk_component(hull)]  WM_DELETE_WINDOW [code $this shutdown]

}

proc classname::shutdown
{
   if {![closeSession]} {
 # If the user didn't cancel, exit
 exit
    }
}

原文地址:https://www.cnblogs.com/greencolor/p/2115408.html