Contrib/book-examples/f-16.3.pl
raw| 1 | #!/usr/local/bin/perl -w |
| 2 | |
| 3 | # |
| 4 | # Figure 16.3, p162 |
| 5 | # |
| 6 | |
| 7 | |
| 8 | # how to do this ? |
| 9 | |
| 10 | use Tk; |
| 11 | |
| 12 | $mw = MainWindow->new; |
| 13 | $country = "Japan"; |
| 14 | &watch($country); |
| 15 | $country = "Great Britain"; |
| 16 | |
| 17 | sub watch { |
| 18 | my ($name) = @_; |
| 19 | my $watch = $mw->Toplevel; |
| 20 | $watch->Label(-text => 'Value of $name: ')->pack (-side => 'left'); |
| 21 | $watch->Label(-textvariable => $name)->pack(-side => 'left'); |
| 22 | # $watch->update; |
| 23 | } |
| 24 | |
| 25 | MainLoop; |