# This demonstration script creates a simple collection of widgets
# that allow you to select and view images in a Tk label.
my($demo) = @_;
$TOP = $MW->WidgetDemo(
-name => $demo,
-text => 'This demonstration allows you to view images using a Tk "photo" image. First type a directory name in the listbox, then type Return to load the directory into the listbox. Then double-click on a file name in the listbox to see that image.',
-title => 'Image Demonstration #2',
-iconname => 'image2',
);
my $dir_label = $TOP->Label(-text => 'Directory:');
my $demo_img = Tk->findINC('demos/images');
my $dir_name = $TOP->Entry(-width => 30, -textvariable => \$demo_img);
my $frog0 = $TOP->Frame;
my $frog = $frog0->Frame;
my $file_label = $frog->Label(-text => 'File:');
my $f = $frog->Frame;
my(@pl) = qw/-side top -anchor w/;
$dir_label->pack(@pl);
$dir_name->pack(@pl);
# All these "frog" and "toad" frames are just to repackage the listbox
# and image side by side so they fit within an SVGA screen.
$frog0->pack;
$frog->pack(qw/-side left/);
my $toad = $frog0->Frame;
$toad->pack(qw/-side right/);
$file_label->pack(@pl);
$f->pack(@pl);
my $f_list = $f->Listbox(-width => 20, -height => 10);