Hello All....

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??

Here is the code I have so far.

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;

zzSPECTREz


In reply to Tk::Thumbnail --> callback help by zzspectrez

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.