user865044
user865044

Reputation: 5

perl TK combination/ I cannot find any example

I'm searching for any moderately short example that I can download which would combine Perl/GTK or any other graphics environment with buttons displayed after excution.

Upvotes: 0

Views: 51

Answers (1)

choroba
choroba

Reputation: 241908

#!/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

Related Questions