O'Reilly logo

Mastering Perl/Tk by Nancy Walsh, Stephen Lidie

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

Combining a bitmap, text, spaces, and an image

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required