运行时未知问题 Perl/Tk
Unknown issue in runtime Perl/Tk
我试过 SU 的这段代码,但它给出了这个错误:
couldn't connect to display ":0" at /usr/lib/perl5/vendor_perl/5.30/x86_64-cygwin-threads/Tk/MainWindow.pm line 53.
MainWindow->new() at A2.pl line 9.
我正在使用 Windows 8.
#!/usr/bin/perl
use warnings;
use strict;
use Tk qw{ MainLoop };
my $mw = 'MainWindow'->new;
my $b_show;
$b_show = $mw->Button(-text => 'Show',
-command => sub {
$b_show->configure(-command => undef);
$mw->Button(-text => 'Quit',
-command => sub { exit })->pack;
})->pack;
MainLoop();
我试过 SU 的这段代码,但它给出了这个错误:
couldn't connect to display ":0" at /usr/lib/perl5/vendor_perl/5.30/x86_64-cygwin-threads/Tk/MainWindow.pm line 53.
MainWindow->new() at A2.pl line 9.
我正在使用 Windows 8.
#!/usr/bin/perl
use warnings;
use strict;
use Tk qw{ MainLoop };
my $mw = 'MainWindow'->new;
my $b_show;
$b_show = $mw->Button(-text => 'Show',
-command => sub {
$b_show->configure(-command => undef);
$mw->Button(-text => 'Quit',
-command => sub { exit })->pack;
})->pack;
MainLoop();