error:not a Tk object Tk::die_with_trace at G:/Dwimperl/Perl/site/lib/Tk.pm line 251 Tk::__ANON__ at final_code.pl line 141 main::push_button1 at G:/Dwimperl/Perl/site/lib/Tk.pm line 251 (eval) at G:/Dwimperl/Perl/site/lib/Tk.pm line 251 Tk::__ANON__ at G:/Dwimperl/Perl/site/lib/Tk/Button.pm line 175 Tk::Button::butUp at G:/Dwimperl/Perl/site/lib/Tk.pm line 424 (eval) at G:/Dwimperl/Perl/site/lib/Tk.pm line 424 Tk::MainLoop at final_code.pl line 87 Tk callback for .button Tk::__ANON__ at G:/Dwimperl/Perl/site/lib/Tk.pm line 251 Tk::Button::butUp at G:/Dwimperl/Perl/site/lib/Tk.pm line 175 <Button-Release1>
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, -scrollb +ars=>'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, -te +aroff => 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'); <br/> 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 1 +0 bold"); my $srl_y = $textarea -> Scrollbar(-orient=>'v',-command=>[yview => $t +xt]); my $srl_x = $textarea -> Scrollbar(-orient=>'h',-command=>[xview => $t +xt]); $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"); } } }
In reply to Error Not a tk object / Problems with multiple files by reaper9187
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |