#!/usr/bin/perl use strict; use Tk; my $mw = MainWindow->new(-title=>'WTF'); $mw->geometry('+10+0'); $mw->overrideredirect(0); my $lab = $mw->Label(-text=>'This is a label in the MainWindow',-font=>'fixed 24',-border=>0)->pack(-anchor=>'w'); $mw->update; $mw->protocol('WM_DELETE_WINDOW' => sub{printf "exit geometry=%s,rootx=%d,rooty=%d;height:%.2f\n",$mw->geometry,$mw->rootx,$mw->rooty,$mw->height; Tk::exit}); printf "init geometry=%s,rootx=%d,rooty=%d;height:%.2f\n",$mw->geometry,$mw->rootx,$mw->rooty,$mw->height; $mw->withdraw; $mw->after(2000,sub{ $mw->state('normal'); return 1; } ); # MainLoop; exit(0); __END__ init geometry=497x32+10+0,rootx=10,rooty=57;height:32.00 exit geometry=497x32+0+19,rootx=10,rooty=57;height:32.00