use warnings; use strict; use Tk; use Tk::Dialog; my $mw = MainWindow->new(); my $dialog_setup = $mw->Dialog(-title => "My Window", -background=>"white",-buttons => [qw/Ok Quit/]); my $frame0 = $dialog_setup->Frame (); $frame0->pack(-side => 'top', -expand => 'both', -fill => 'x'); $frame0->Label(-background=> 'white', -text => "This is my window", -background=>"white")->pack(-side => "left", -anchor => "w",-fill => "both",-expand => "x"); my $answer = $dialog_setup->Show(); if ($answer=~ /Ok/){ do_something();} MainLoop();