Reputation: 19
I have tried this code from SU, but it gives this error:
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.
I'm using 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();
Upvotes: 1
Views: 110
Reputation: 40758
According to this answer and according to the Cygwin/X documentation, you need to install a Cygwin package called xinit
then open a new Cygwin terminal window and execute the command startxwin
. Then in another Cygwin terminal, try to rerun your script. This works for me on Windows 11.
Upvotes: 1