use strict; use warnings; use Tk; my $roomTl; my %window = (xAf=>0.20); my $mw = new MainWindow( ); $mw->Button( -text => "\n Characteristics \n", -command => \&roomSub, )->pack(-fill => "x"); $mw->Button( -text => "\n Calculate \n", -background => "red", -command => \&designSub, )->pack(-fill => "x"); MainLoop; sub roomSub { if (! Exists ($roomTl)) { $roomTl = $mw->Toplevel( ); $roomTl->Entry( -textvariable => \$window{xAf}, )->pack(-fill => 'x'); } else { $roomTl->deiconify(); $roomTl->raise(); } } sub designSub { my $Uf = 13; my $Uw = $window{xAf} * $Uf; print "Uf = $Uf \t xAf = $window{xAf} \t Uw = $Uw \n"; }