| 1 |
#!/usr/local/bin/perl -w |
| 2 |
|
| 3 |
use Tk; |
| 4 |
use Tk::Xrm; |
| 5 |
use Tk::widgets qw(DirTree Button); |
| 6 |
|
| 7 |
# This does not work properly yet |
| 8 |
|
| 9 |
use strict qw(subs); |
| 10 |
|
| 11 |
use Tk::Pretty; |
| 12 |
|
| 13 |
sub top |
| 14 |
{ |
| 15 |
my $name = shift; |
| 16 |
my $top = MainWindow->new(); |
| 17 |
$top->Button('-text'=>"Quit",'-command'=>['destroy',$top])->pack; |
| 18 |
$top->Button('-textvariable'=>\$name, |
| 19 |
'-command'=> [ sub { my $name = shift; print "$name\n"},$name])->pack; |
| 20 |
$top->DirTree()->pack; |
| 21 |
$top->title($name); |
| 22 |
} |
| 23 |
|
| 24 |
&top("One"); |
| 25 |
&top("Two"); |
| 26 |
|
| 27 |
MainLoop; |