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 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.

A LabFrame widget

Figure 23-14. A LabFrame widget

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

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