| 1 |
#!/usr/local/bin/perl -w |
| 2 |
|
| 3 |
# |
| 4 |
# Figure 16.6, p165 |
| 5 |
# |
| 6 |
|
| 7 |
|
| 8 |
use Tk; |
| 9 |
|
| 10 |
my $mw = MainWindow->new; |
| 11 |
$mw->Button(-text => 'OK', -command => \&ok)->pack(-side => 'left'); |
| 12 |
$mw->Button(-text => 'Apply', -command => \&apply)->pack(-side => 'left'); |
| 13 |
$mw->Button(-text => 'Cancel', -command => \&cancel)->pack(-side => 'left'); |
| 14 |
$mw->Button(-text => 'Help', -command => \&help)->pack(-side => 'left'); |
| 15 |
|
| 16 |
sub ok { |
| 17 |
print STDOUT "in OK\n"; |
| 18 |
} |
| 19 |
sub apply { |
| 20 |
print STDOUT "in apply\n"; |
| 21 |
} |
| 22 |
sub cancel { |
| 23 |
print STDOUT "in cancel\n"; |
| 24 |
} |
| 25 |
sub help { |
| 26 |
print STDOUT "in help\n"; |
| 27 |
} |
| 28 |
|
| 29 |
MainLoop; |