use Tk; # Main Window my $mw = new MainWindow; $mw->Frame(-background => 'red')->pack(-ipadx =>50, -side => "left", -fill => "y"); #Making a text area my $txt = $mw -> Scrolled('Text',-width => 150, height => 40, -scrollbars=>'e', -font => "fixed 8 bold" ) -> pack (); $txt->insert('end', ""); #Declare that there is a menu my $mbar = $mw -> Menu(); $mw -> configure(-menu => $mbar); #The Main Buttons my $file = $mbar -> cascade(-label=>"File", -underline=>0, -tearoff => 0); my $tool= $mbar -> cascade(-label =>"Tools", -underline=>0, -tearoff => 0); my $parser = $mbar -> cascade(-label =>"RL Parser", -underline=>0, -tearoff => 0); my $help = $mbar -> cascade(-label =>"Help", -underline=>0, -tearoff => 0); ## File Menu ## $file -> command(-label => "Home", -underline=>0, -command=> \&home ); $file -> command(-label => "Check KPI definitions", -underline=>0, -command=> \&define ); $file -> checkbutton(-label =>"Check for faults", -underline => 0, -command => \&faults); $file -> separator(); $file -> command(-label =>"Exit", -underline => 1, -command => sub { exit } ); ## Tools Menu ## $tool -> command(-label => "Network planning", -underline=>0, -command=> \&nwplan ); $tool -> command(-label => " ", -underline=>0, -command=> \&optimize ); $tool -> separator(); $tool -> command(-label =>"Network Planning Rules", -underline =>1, -command => sub { $txt -> delete('1.0', 'end');
sub define { my $mw = new MainWindow; # Main Window my $frm_name = $mw -> Frame(); my $lab = $frm_name -> Label(-text=>"Enter KPI:"); my $ent = $frm_name -> Entry(); my $but = $mw -> Button(-text=>"Check", -command =>\&push_button1); my $textarea = $mw -> Frame(); #Creating Another Frame my $txt = $textarea -> Text(-width=>130, -height=>30, -font=> "fixed 10 bold"); my $srl_y = $textarea -> Scrollbar(-orient=>'v',-command=>[yview => $txt]); my $srl_x = $textarea -> Scrollbar(-orient=>'h',-command=>[xview => $txt]); $txt -> configure(-yscrollcommand=>['set', $srl_y], -xscrollcommand=>['set',$srl_x]); $lab -> grid(-row=>1,-column=>1); $ent -> grid(-row=>1,-column=>2); $frm_name -> grid(-row=>1,-column=>1,-columnspan=>2); $but -> grid(-row=>4,-column=>1,-columnspan=>2); $txt -> grid(-row=>1,-column=>1); $srl_y -> grid(-row=>1,-column=>2,-sticky=>"ns"); $srl_x -> grid(-row=>2,-column=>1,-sticky=>"ew"); $textarea -> grid(-row=>5,-column=>1,-columnspan=>2); $txt -> insert('end'," *some text* ");} else {$txt -> delete('1.0', 'end'); $txt -> insert('end'," Wrong Keyword. Please Try Again"); } } }