pseudosocrates has asked for the wisdom of the Perl Monks concerning the following question:
use Tk; use Tk::JPEG; use Tk::Thumbnail; use strict; my @countries = ("England", "Scotland"); my @justfiles = ("./England/pic1.jpg", "./Scotland/pic1.jpg", "./England/pic2.jpg", "./Scotland/pic2.jpg"); my @selection; my $country; my $mw = MainWindow->new; $mw->geometry("600x400"); my $menuframe = $mw->Frame(-bg => 'blue', -container => 0); $menuframe->pack(-side => 'left', -fill => 'y'); my $mainframe = $mw->Frame(-bg => 'darkblue', -container => 0); $mainframe->pack(-fill => 'both', -expand => 1); foreach (@countries) { $menuframe->Radiobutton ( -variable => \$country, -text => "$_", -value => "$_", -command => \&choosethumbs )->pack; } MainLoop; sub choosethumbs { @selection = grep(m/.*\/$country\/.*/, @justfiles); my $thumb = $mainframe->Thumbnail(-images => [<@selection>], -labels = +> 0, -width => '75', -height => '75', -background => 'black', -command = +> \&openwin)->pack; } sub openwin { my $tw = MainWindow->new; my $pic = $tw->Photo(-file=>$_[1]); $tw->Label(-image => $pic)->pack; };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tk::Thumbnail newbie issues
by pg (Canon) on Nov 13, 2003 at 04:07 UTC |