我的任务需要通过peri中的gui持续执行.
设置包括文本字段,按钮和文本区域.按下该按钮时,系统命令将使用文本字段中的值重复运行,并在文本区域中显示输出.
例如,考虑以下代码:使用Tk;
# Main Window
my $mw = new MainWindow;
#GUI Building Area
my $frm_name = $mw -> Frame();
my $lab = $frm_name -> Label(-text=>"Command");
my $ent = $frm_name -> Entry();
#Button and command
my $ent = $mw -> Entry() -> pack();
my $but = $mw -> Button(-text=>"Run Command", -command =>\&push_button) -> pack();
#Text Area
my $textarea = $mw -> Frame();
my $txt = $textarea -> Text(-width=>40, -height=>10) -> pack();
#Geometry Management
$lab -> grid(-row=>1,-column=>1);
$ent -> grid(-row=>2,-column=>1);
$frm_name …Run Code Online (Sandbox Code Playgroud)