reaper9187 has asked for the wisdom of the Perl Monks concerning the following question:
Tk::Error: Failed to AUTOLOAD 'Tk::Widget::insert' at C:/Dwimperl/perl +/site/lib/ Tk/Derived.pm line 469 Carp::croak at C:/Dwimperl/perl/lib/Carp.pm line 100 Tk::Widget::__ANON__ at C:/Dwimperl/perl/site/lib/Tk/Widget.pm line 3 +47 Tk::Derived::Delegate at C:/Dwimperl/perl/site/lib/Tk/Derived.pm line + 469 Tk::Widget::__ANON__ at C:/Dwimperl/perl/site/lib/Tk/Widget.pm line 3 +22 main::push_button2 at top.pl line 62 Tk callback for .toplevel.button1 Tk::__ANON__ at C:/Dwimperl/perl/site/lib/Tk.pm line 251 Tk::Button::butUp at C:/Dwimperl/perl/site/lib/Tk/Button.pm line 175 <ButtonRelease-1> (command bound to event)
#!/usr/local/bin/perl use Tk; require Tk::ROText; require Tk::TextUndo; use Carp; use Tk::widgets qw(Canvas); use Tk::Xlib; use Math::Cartesian::Product; use List::Util qw[min max]; use List::MoreUtils qw(firstidx); # Main Window my $mw = new MainWindow; $mw->title('File preview'); $mw->scaling($ARGV[0]) if (@ARGV); my $screen = $mw->Screen; my $width1 = $screen->WidthOfScreen; my $height1 = $screen->HeightOfScreen; $mw->Frame(-background => 'red')->pack(-ipadx =>50, -side => "left", - +fill => "y",); #Making a text area my $txt = $mw -> Scrolled('ROText',-width => $width1, height => $heigh +t1, -scrollbars=>'e', -font => "fixed 10 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, -tearof +f => 0); my $tool= $mbar -> cascade(-label =>"Tools ", -underline=>0, -tearo +ff => 0); my $parser = $mbar -> cascade(-label =>"Check ", -underline=>0, -te +aroff => 0); my $help = $mbar -> cascade(-label =>"Help ", -underline=>0, -tearo +ff => 0); ## Tools Menu ## $tool -> command(-label => "ABC", -underline=>0, -command=> \&nwplan ); $tool -> command(-label => "CC", -underline=>0, -command=> \&optimize ); $tool -> separator(); $tool -> command(-label =>"WW", -underline =>1, -command => \&do_top); $tool -> command(-label =>"Clear", -underline => 0, -command => sub {$txt->delete('1.0','end');}); MainLoop; sub do_top { if (! Exists($tl)) { $tl = $mw->Toplevel; $tl->title('Help'); $tl->geometry( "1000x700" ); my $frame = $tl->Frame()->pack; my $lab = $tl->Label()->pack; my $ent = $tl->Entry()->pack; $tl->Button(-text => 'Exit',-command => sub { $tl->destroy;})->pa +ck; $tl->Button(-text => 'Open File1',-command =>\&push_button2)->pack; my $text = $tl->Scrolled('Text')->pack(); sub push_button2{ $text->insert('end',"You pushed button2\n");} } else { $tl->deiconify; $tl->raise; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: failed AUTOLOAD widgets when trying to destory widget
by Anonymous Monk on Oct 26, 2012 at 08:22 UTC | |
by reaper9187 (Scribe) on Oct 26, 2012 at 10:26 UTC | |
|
Re: failed AUTOLOAD widgets when trying to destory widget
by zentara (Cardinal) on Oct 26, 2012 at 11:37 UTC | |
by reaper9187 (Scribe) on Oct 26, 2012 at 12:06 UTC | |
by zentara (Cardinal) on Oct 26, 2012 at 14:37 UTC | |
by reaper9187 (Scribe) on Oct 26, 2012 at 15:20 UTC |