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 Pane Widget

The Pane widget is essentially a Frame widget that may be scrolled. Within the Pane, you can pack whatever widgets however you like:

my $pane = $mw->Scrolled(qw/Pane -scrollbars osw/)->pack;

foreach (1 .. 20) {
    $pane->Label(-text => "Label $_")->pack;
}

The previous code produced Figure 23-17.

A Pane widget with a Scrollbar

Figure 23-17. A Pane widget with a Scrollbar

Pane Options

The following options are available for Pane:

-gridded => 'x' | 'y' | 'xy'

Specifies if the top and left edges of the pane should snap to a grid column. This option is useful only if the widgets in the pane are managed by the grid geometry manager.

-sticky => style

If the Pane is larger than its requested dimensions, this option may be used to position (or stretch) the slave widgets within their cavity. style is a string that contains zero or more of the characters n, s, e, or w. Each letter refers to a side (north, south, east, or west) to which the slave sticks. If both n and s (or e and w) are specified, the slave is stretched to fill the entire height (or width) of its cavity.

There are also various methods to position the Pane’s view. See the POD documentation for more information.

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