| 1 |
#!/usr/local/bin/perl -w |
| 2 |
|
| 3 |
use Tk; |
| 4 |
|
| 5 |
|
| 6 |
$path = Tk->findINC("demos/images"); |
| 7 |
|
| 8 |
$top = MainWindow->new(); |
| 9 |
|
| 10 |
$bitmap = $top->Bitmap( '-file' => "$path/dir.icon", |
| 11 |
'-maskfile' => "$path/dir.mask"); |
| 12 |
|
| 13 |
$photo = $top->Photo( 'photo'); |
| 14 |
|
| 15 |
$pixmap = $top->Pixmap( 'quit' , '-file' => "$path/QuitPB.xpm"); |
| 16 |
|
| 17 |
$top->Label('-image'=> $bitmap)->pack; |
| 18 |
$top->Label('-image'=> $photo )->pack; |
| 19 |
my $f = $top->Frame->pack; |
| 20 |
$f->Button('-text' => 'PPM', '-command' |
| 21 |
=> ['configure',$photo, -file => "$path/teapot.ppm" ] )->pack(-side => 'left'); |
| 22 |
$f->Button('-text' => 'GIF', '-command' |
| 23 |
=> ['configure',$photo, -file => "$path/mickey.gif" ] )->pack(-side => 'left'); |
| 24 |
|
| 25 |
$f->Button('-text' => 'XBM', '-command' |
| 26 |
=> ['configure',$photo, -file => "$path/face" ] )->pack(-side => 'left'); |
| 27 |
$f->Button('-text' => 'XPM', '-command' |
| 28 |
=> ['configure',$photo, -file => "$path/QuitPBa.xpm" ] )->pack(-side => 'left'); |
| 29 |
$f->Button('-text' => 'Blank', '-command' => ['blank',$photo] )->pack; |
| 30 |
$top->Button('-image'=> $pixmap, '-command'=>['destroy',$top] )->pack; |
| 31 |
|
| 32 |
MainLoop; |