Stephen O. Lidie > Tk-Thumbnail > Tk::Thumbnail



Annotate this POD

Related Modules

View/Report Bugs
Module Version: 1.3   Source  


Tk::Thumbnail - Create a grid of shrunken images.


 $thumb = $parent->Thumbnail(-option => value, ... );


Create a table of thumbnail images, having a default size of 32 x 32 pixels. Once we have a Photo of an image, shrink it by copying a subsample of the original to a blank Photo. Images smaller than the thumbnail dimensions are enlarged by zooiming.

Clicking on an image displays it full-size in a separate window with a "Get Info" button. The info window shows the image's width, height, path name, size and frame count.

For multi-frame GIFs the image is shown in a Tk:: MultiMediaControls window. This is a QuickTime-like controller widget, allowing you to play, pause, rewind, stop, fast-forward and fast-reverse the animation. The Space bar toggles play/pause. Left and right arrow keys step the animation frame by frame, either forward or reverse.


A list of file names and/or Photo widgets. Thumbnail creates temporarty Photo images from all the files, and destroys them when the Thumbnail is destroyed or when a new list of images is specified in a subsequent configure call. Already existing Photos are left untouched.


A boolean, set to TRUE if you want file names displayed under the thumbnail images.


The default font is fixed.


Pixel width of the thumbnails. Default is 32. The special value -1 means don't shrink images in the X direction.


Pixel height of the thumbnails. Default is 32. The special value -1 means don't shrink images in the Y direction.


A callback that's executed on a <Button-1> event over a thumbnail image. It's passed six arguments: the Label widget reference containing the thumbnail Photo image, the file name of the Photo, a boolean indicating whether or not the the Photo is valid, the Photo's pixel width and height, and a boolean indicating whether the image is a single frame (Tk::Photo) or has multiple frames (Tk::Animation).

A default callback is provided that simply displays the original image in a new Toplevel widget, along with a Get Info Button that opens another Toplevel containing information about the image. If the image has multiple frames, then QuickTime-like controller buttons are also presented to view the animation, and the left and right arrow keys single-step the animation frame-by-frame. The space bar toggles the play/pause button.


Number of Photos per row. The column count is computed if not specified.


For animated GIFs, a boolean specifying whether to blank the animation photo between movie frames. Default is 1.



Destroys all Frames and Labels, and deletes all the temporary Photo images, in preparation for re-populating the Thumbnail with new data.


 $thumb = $mw->Thumbnail( -images => [ <images/*.ppm> ], -ilabels => 1 );



Copyright (C) 2001 - 2005, Steve Lidie. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


v 1.3 2005/05/15

Added -blank option to make some Tk::Animations look better. Added -columns option by


thumbnail, image, QuickTime, Apple, photo, animation

syntax highlighting: