As you might be able to tell the sub window is a "go to" line function in a text editor script I am writing and needs to be opened and closed multiple time during one session. How can I change it to do this more than once successfully. The error is:sub go_to { my $sw = $mw->Toplevel(-title=>"Go To Line"); my $frame = $sw->Frame->pack(-side => 'top', -fill => 'x'); $frame->Label(-text => "Enter Line Number:")->pack(-side => 'left', + -anchor => 'w'); $frame->Entry(-textvariable => \$line_number)-> pack(-side => 'left', -anchor => 'w', -fill => 'x', -expand => 1 +); $frame->Button(-text => "GO", -background => 'navy blue', -foregrou +nd => 'white', -command =>\&scroll_line)-> pack(-side => 'right'); sub scroll_line { $line_number = $line_number - 1; my $calc = $line_number/$line_count; $t->yviewMoveto($calc); $line_number = $line_number + 1; $sw->destroy(); } }
Tk::Error: Usage $widget->destroy(...) at C:\Documents and Settings\My_Name\My Documents\scripts\perl_edit.pl line 343. \&main::scroll_line Tk callback for .toplevel.frame.button Tk::__ANON__ at C:/Perl/site/lib/Tk.pm line 228 Tk::Button::butUp at C:/Perl/site/lib/Tk/Button.pm line 111 (command bound to event) destroy (1): 0 0x1a6dfe4 RV f=00080503 {}(1)(1) SV = RV(0x2104260) at 0x1a6dfe4 REFCNT = 1 FLAGS = (PADBUSY,PADMY,ROK) RV = 0x2145d78
In reply to Re: Re: clsoing sub window upon execution?
by Elijah
in thread clsoing sub window upon execution?
by Elijah
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |