reaper9187 has asked for the wisdom of the Perl Monks concerning the following question:
Hi everyone,
I'm developing a small application that reads multiple reports and displays some results. I'm using spreadsheet::parseExcel and have developed GUI using perl/Tk.
Now, i'm facing two issues mainly:
1. I'm not very well versed with the bind option. I'm finding it a little difficult to attach it the callback of a subroutine. Now the problem is , everytime i close the window and try opening it back again, it gives me this error
2. The script i'm using parses the values in an excel file by the row/column numbers of the multiple excel files. I'm able to run this script on a test file but when i try to run it for a different file, it just doesnt work. In addition it gives me this error.
This is becoming really frustrating now. Please help
Attached is code below:
Now, i'm facing two issues mainly:
1. I'm not very well versed with the bind option. I'm finding it a little difficult to attach it the callback of a subroutine. Now the problem is , everytime i close the window and try opening it back again, it gives me this error
2. The script i'm using parses the values in an excel file by the row/column numbers of the multiple excel files. I'm able to run this script on a test file but when i try to run it for a different file, it just doesnt work. In addition it gives me this error.
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>
This is becoming really frustrating now. Please help
Attached is code below:
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"); } } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Error Not a tk object / Problems with multiple files
by Anonymous Monk on Oct 16, 2012 at 11:33 UTC | |
by reaper9187 (Scribe) on Oct 16, 2012 at 11:50 UTC | |
by zentara (Archbishop) on Oct 16, 2012 at 11:59 UTC | |
by reaper9187 (Scribe) on Oct 16, 2012 at 12:03 UTC | |
by zentara (Archbishop) on Oct 16, 2012 at 12:14 UTC | |
|
Back to
Seekers of Perl Wisdom