start page | rating of books | rating of authors | reviews | copyrights

Book HomeMastering Perl/TkSearch this book

17.8. The Compound Image Type

We can combine existing images, bitmap, and text characters to create a multiline mega-image called a Compound, which we then use just like any other image.

The first and third lines are vertical spacers, 10 pixels in height. The second line combines a bitmap, text, and an image separated by horizontal spacers. Although the components of a Compound have configurable foreground and background colors and can be justified and anchored in various ways, that's really all there is to Compounds.

my $c = $b->Compound;

$c->Space(-height => 10);       # line 1

$c->Line;                          # line 2
$c->Space(-width => 10);
$c->Bitmap(-bitmap => 'hourglass', -foreground => 'red');
$c->Space(-width => 10);
$c->Text(-text => "Searching for ", -font => 'times 19');
$c->Image(-image => $b->Pixmap(-file => 'Icon.xpm'));
$c->Space(-width => 10);

$c->Line;                          # line 3
$c->Space(-height => 10);

These statements created the three-line Compound in Figure 17-15.

Figure 17-15

Figure 17-15. Combining a bitmap, text, spaces, and an image



Library Navigation Links

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