我想要的只是一个多行文本条目。
所以我使用了 TK::Text 而不是 TK::Entry。
use Tk;
my $mw = MainWindow->new(-width => '1000', -relief => 'flat',
-height => '840', -title => 'Test', -background => 'white', );
$mw->geometry("1000x840+200+200");
my $desc = $mw->Scrolled('Text', -scrollbars => 'e',
-width => 50, -height => 3)->place(-x => 10, -y => 170);
my $goButton = $mw->Button( -pady => '1', -relief => 'raised',
-padx => '1', -state => 'normal', -justify => 'center',
-text => 'Go', -width => 15, -height => 1,
-command => sub {$mw->destroy;})->place( -x => 12, -y => 770);
my $cancelButton = $mw->Button( -pady => '1', -relief => 'raised',
-padx => '1', -state => 'normal', -justify => 'center',
-text => 'Cancel', -width => 8, -height => 1,
-command => sub { exit 0; })->place( -x => 140, -y => 770);
$mw -> MainLoop();
print $desc->get('1.0');
但是当我运行这段代码时,我得到了这个错误:
无法自动加载“Tk::Frame::get”
我究竟做错了什么?
谢谢!