Book HomeMastering Perl/TkSearch this book

23.7. The LabFrame Widget

A LabFrame widget has all the features of a Frame and additionally provides a text label on the 'top', 'bottom', 'left', or 'right' of the Frame. The special placement option 'acrosstop' creates a grooved Frame around the central Frame and puts the label near the northwest corner such that it overlays the groove.

use Tk;
use Tk::LabFrame;
use strict;

my $mw = MainWindow->new(-title => 'LabFrame example')
my $lf = $mw->LabFrame(-label => "This is the label of a LabFrame",
     -labelside => 'acrosstop')->pack;
$lf->Text(qw/-width 40 -height 5/)->pack;
MainLoop;

This code produces the widget shown in Figure 23-14.

Figure 23-14

Figure 23-14. A LabFrame widget

23.7.1. LabFrame Options

LabFrame supports the same options as the Frame widget, plus:

-label => text
The text of the label to be placed with the Frame

-labelside => 'left' | 'right' | 'top' | 'bottom' | 'acrosstop'
Where to put the label on the frame



Library Navigation Links

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