#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::JPEG; use Tk::Pane; use File::Spec; use Data::Dump; my $glob = $ARGV[0]||'./*.jpg'; my @files; &build_list($glob); ########################################################### my $mw = new MainWindow (); $mw->geometry("100x50+0+0"); $mw->Button(-text => "nex picture", -command => sub{ &next_pic; } )->pack(); my $phwin = $mw->Toplevel(); # default empty image # see http://www.perlmonks.org/?node_id=535837 my $image = $phwin->Photo(-file => '' ) or die $!; my $photo_label; #fill mainframe with default screen setup_pane(); $mw->MainLoop; ################################################################################ sub next_pic { my $pic_file = shift @files; print "processing [$pic_file]\n"; $image->blank; $image = $phwin->Photo(-file => $pic_file ); $photo_label->configure(-image => $image ); } ############################################################# # see http://www.perlmonks.org/?node_id=535837 sub setup_pane{ my $pane = $phwin->Scrolled('Pane', Name => 'Main Display', -width => 1000, -height =>1000, -background => 'black', -scrollbars => 'osoe', -sticky => 'n', )->pack(-side => "left", -anchor => "n", -fill=>'both',-expand=>1); # the global! $photo_label = $pane->Label(-image => $image, -background =>'black' )->pack(-side => 'top', -anchor => 'n', -fill => 'both', -expand => 1, ); } ################################################################################ sub build_list{ my $glob=shift; print "received [$glob]\n"; map { push @files,File::Spec->file_name_is_absolute($_) ? $_ : File::Spec->rel2abs($_); } glob($glob); print "$_\n" for @files; }