in reply to tk close window

I tried it with Tk::DialogBox. I added a cancel_button and a sub to exit.
#!/usr/bin/perl use strict; use warnings; use Tk; use Tk::DialogBox; require Tk::Dialog; my $mw = MainWindow->new; my $d = $mw->Dialog( -title => "My Window", -background => "white", -cancel_button => "Quit", -buttons => [qw/Ok Quit/]); my $frame0= $mw->Frame (); $frame0->Label( -text => "This is my window", -background => "white")->pack; my $answer = $d->Show(); Exit(); MainLoop(); sub Exit { exit 0; }