#!/usr/bin/perl -w use strict; use Tk; use Tk::JPEG; my $c; my $dir = "c:/temp"; my @fl = ("01.jpg","05.jpg"); my $main = new MainWindow; nextp(); my $nxt = $main->Button('-text' => "Next", '-command' => \&nextp)->pack(); $main->Button(-text => 'exit', -command => sub{destroy $main} )->pack(-anchor => 'e'); MainLoop; sub loadpic { my $filename = shift; my $size; my $orientation; $main -> Photo('img', -file => $filename); my ($h,$w) = ($main->height, $main->width); # # how to scale the pic? # $c = $main->Label('-image' => 'img')->pack; return; } sub nextp { my $f = shift(@fl); loadpic("$dir/$f"); return; }