prince26121991 has asked for the wisdom of the Perl Monks concerning the following question:
use Tk; use strict; my $mw = MainWindow->new; $mw->geometry("200x300"); $mw->title("MAIN WINDOW"); my $lname1; my $button_frame1 = $mw->Frame()->pack(-side => "top"); $button_frame1->Button(-text => "GI EXTRACTOR", -command => \&window1) +->pack(); sub window1 { my $mw = MainWindow->new; $mw->geometry("700x700"); $mw->title("GI EXTRACTOR WINDOW"); my $button_frame1 = $mw->Frame()->pack(-side => "top"); $button_frame1->Button(-text => "Browse File", -command => \&updat +e_output1)->pack(-side => "top"); my $bf1 = $mw->Frame()->pack(-side => "top"); $bf1->Label(-text => "You Have Selected The Following File")->pack +(-side => "left"); $bf1->Entry(-bg=>'red',-textvariable => \$lname1)->pack(-side => " +left"); my $b_f1 = $mw->Frame()->pack(-side => "top"); $b_f1->Button(-text => "Ok", -command => \&u_o1)->pack(-side => "b +ottom"); my $output_frame1 = $mw->Frame()->pack(-side => "bottom"); my $output_scroll1 = $output_frame1->Scrollbar(); my $output_text1 = $output_frame1->Text(-yscrollcommand => ['set', + $output_scroll1]); $output_scroll1->configure(-command => ['yview', $output_text1]); $output_scroll1->pack(-side => "right", -expand => "no", -fill => +"y"); $output_text1->pack(); sub update_output1 { my $button_frame1 = $mw->getOpenFile(); $lname1=$button_frame1; } sub u_o1 { my $output1; open(FH,"<$lname1"); while(my $_=<FH> ) { if($_=~/^>gi/) { my@arr=split(/\|/,$_); $output1=$arr[0].$arr[1]; } } close(FH); $output_text1->delete('0.0', 'end'); $output_text1->insert("end", $output1); } } MainLoop;
This is a simple Tk program which opens a Main Window having a button called"GI Extractor" After clicking on it gives a new window" GI Extractor WINDOW" having total 5 widget
1.Browse file(which call getOpenFile()); 2.label (shows hardcoded text); 3.ENTRY(which show address of selected file); 4.ok button (which call mechanism of this program); 5.scrollbox(which shows ouput);
Now when I click on GI Extractorbutton in "Main Window", It works like a charm
But when once I close "GI EXTRACTOR WINDOW"and Reopen it using same button It neither Deletes previous entry nor takes new Entry
Instead of it gives a very long error in Command line
Hoping for a good reply with some example code coz I searching for this problem since last 5 hour please help
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: widget box problem in tk
by Anonymous Monk on May 12, 2014 at 03:00 UTC | |
by prince26121991 (Novice) on May 12, 2014 at 04:25 UTC | |
Re: widget box problem in tk
by ww (Archbishop) on May 12, 2014 at 12:18 UTC |