home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

Book HomeMastering Perl/TkSearch this book

17.2. Methods Common to All Image Types

Images are real objects; we need to create them and, when we're finished, destroy them; otherwise, their resources remain in use for the duration of program execution. For instance, if we create an image and assign it to a Label, then at some later time destroy the Label, like so:

my $l = $mw->Label(-image -> $image)

the image remains alive and ready for use again and again, even by multiple widgets simultaneously. If we want the image to go away, we must explicitly delete it:


This applies to Bitmap, Pixmap, and Photo image types. Here are other methods available for any image type:

Returns the value of the image option -option

$image->configure(-option => value)
Configures the specified option

Deletes the image

Returns the pixel height of the image

Returns the image type of the image

Returns the pixel width of the image

Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.