Your first Perl/Tk program : Button « GUI « Perl






Your first Perl/Tk program

 

#!/usr/bin/perl
use Tk;
my $mw = MainWindow->new;
$mw->title('Hello World');
$mw->Button(-text => 'Done', -command => sub { exit })->pack;
MainLoop;

   
  








Related examples in the same category

1.Adding button (control) to a window
2.Pass subroutine to button and get called when clicking
3.Pass value to a subroutine in button action
4.Set Button action command
5.Load and save text file
6.Link a subroutine with a button action