$mw->protocol('WM_DELETE_WINDOW',[\&stop]); sub stop{ $mw -> destroy; }