use strict; use warnings; use Tk; use Tk::DialogBox; my $main = MainWindow->new(); my $Action_Submit = $main->Button(-text => 'Submit', -command => [\&get_input ])->place(-x => 700, -y => 45); my $Action_Exit = $main->Button(-text => 'Exit', -command => [$main => 'destroy'])->place(-x => 700, -y => 115); $Action_Submit->pack (); $Action_Exit->pack (); MainLoop; # This menu has several radio and action buttons. Once # filled out, I want to first pull all of the data input # into the menu and place them into variables....then exit. However, this does # not Exit the menu as i would think it should. Instead the menu stays active # until we actually exit the script. sub get_input { my $dlg = $main->DialogBox(-title => "Options", -buttons => ["OK", "Cancel"]); my $name; my $nameEdit = $dlg->add ('Entry', -textvariable => \$name)->pack (); return if $dlg->Show () ne 'OK'; print "Name is $name\n"; }