zzspectrez has asked for the wisdom of the Perl Monks concerning the following question:
It has been quite a while since I have played with perl, or visited the monestary. I just recently started playing with perl and perl/tk to display some thumbnails of images which I would like the user to be able to select by clicking on the images.
I was able to setup a callback to the button click or image click. So selection will not be an issue. However, I want it to be visible which images are selected. Since the call back is passed a ref to the widget, I thought I could either select a thick border or change the relief option to make it visible. These options when changed do not appear visualy. I suppose that the -image option must override these options. Any suggestions other than rewriting Tk::Thumbnail to add checkboxes??
use Tk; use Tk::Thumbnail; ## GLOBALS my $mw; my $thumb; ## Subroutines sub thumb_cmd { my ( $widget, $filename, $is_bad, $pix_width, $pix_height, $frames ) = @_; if ($is_bad) { print "IS INVALID IMAGE\n"; return; }else{ print "Valid Image.\n"; print "Thumbnail information:\n"; print "\tFilename: [$filename]\n"; print "\tWidth: $pix_width\n"; print "\tHeight: $pix_height\n"; ## I Tried adding code that modified ## options of $widget... ## ie... $widget->configure( -relief => 'raised' ); return; } } sub init { my @img = ( <*.jpg>, <*.bmp> ); $mw = MainWindow->new; $thumb = $mw->Thumbnail( -images => \@img, -ilabels => 1, -iheight => 75, -iwidth => 75, -command => \&thumb_cmd, )->pack; } ## MAIN init; MainLoop;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Tk::Thumbnail --> callback help
by zentara (Cardinal) on Apr 14, 2005 at 21:35 UTC | |
by zzspectrez (Hermit) on Apr 15, 2005 at 01:15 UTC | |
by zentara (Cardinal) on Apr 15, 2005 at 11:25 UTC | |
Re: Tk::Thumbnail --> callback help
by zzspectrez (Hermit) on Apr 14, 2005 at 04:39 UTC | |
by zentara (Cardinal) on Apr 14, 2005 at 13:14 UTC | |
by zzspectrez (Hermit) on Apr 14, 2005 at 14:32 UTC | |
by zentara (Cardinal) on Apr 14, 2005 at 18:24 UTC |