我是 Tk/Perl 的新手。下面是我使用 tk/perl 创建的简单 GUI 界面。
以下是创建此 GUI 的部分代码。
$f2_label=$f_frame_top0->Label(-text=>"File",-font=>[-family=>'MS Sans Serif',-size=>9,-weight=>'bold',-underline=>0],-justify=>'left')->pack(-side=>'left',-anchor=>'w',-padx=>1,-pady=>1,);
$f2_entry=$f_frame_top0->Entry(-width=>50,-state=>"normal")->pack(-side=>'left',-anchor=>'w',-padx=>1,-pady=>1,-fill=>'x',-expand=>1);
$f2_file_btn=$f_frame_top0->Button(-text=>"...", -height=>1, -width=>2, -command=> [\&file_search,$tab2,$f2_entry,"TXT"])->pack(-side=>'left',-anchor=>'w',-padx=>1,-pady=>1);
$f3_label=$f_frame_top1->Label(-text=>"Number",-font=>[-family=>'MS Sans Serif',-size=>9,-weight=>'bold',-underline=>0],-justify=>'left')->pack(-side=>'left',-anchor=>'w',-padx=>1,-pady=>1,);
$f3_entry=$f_frame_top1->Text(-width=>10,-height=>10,-wrap=>'word',-state=>"normal")->pack(-side=>'left',-anchor=>'w',-padx=>1,-pady=>1,-fill=>'x',-expand=>1);
$but1_close=$f_frame_bot->Button(-text=>"Close",-command=>sub {destroy $mw}) ->pack(-side=>"right",-anchor=>'e',-padx=>1,-pady=>1);
$but1_exe=$f_frame_bot->Button(-text=>"Run",-command=>[\&fablot_fusesort,$f2_entry,$f3_entry] ) ->pack(-side=>"right",-anchor=>'e',-padx=>1,-pady=>1);
sub fablot_fusesort{
my $file1 = shift -> get();
my $number = shift ->get();
}
我想让用户在文本中输入的数字(22、23、24、25、26)在我的子程序中处理,但我无法从 shift -> get() 中获取它。有什么办法可以让用户在文本小部件中输入的所有数字?感谢您的帮助