zhaoyangjian724
#!/usr/local/bin/perl
use Tk;
my $mw = new MainWindow; # Main Window
my $frm_name = $mw -> Frame() -> pack();
my $lab = $frm_name -> Label(-text=>"Name:") -> pack();
my $ent = $frm_name -> Entry() -> pack();
my $but = $mw -> Button(-text=>"Push Me", -command =>\&push_button) -> pack();
#Text Area
my $txt = $mw -> Text(-width=>40, -height=>10) -> pack();
MainLoop;
#This function will be executed when the button is pushed
sub push_button {

##从输入框获取输入,
my $name = $ent -> get();
##从输入框获取输入,插入到文本框
$txt -> insert(\'end\',"Hello, $name");
}



分类:

技术点:

相关文章:

  • 2021-11-14
  • 2022-01-02
  • 2021-09-27
  • 2022-02-27
  • 2022-12-23
  • 2021-07-08
  • 2022-02-02
猜你喜欢
  • 2022-12-23
  • 2022-01-19
  • 2022-12-23
  • 2021-07-04
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案