The grid Geometry Manager
The grid
geometry
manager divides the window into a grid composed of columns and rows
starting at 0,0 in the upper lefthand corner. The resulting grid
resembles a spreadsheet, with each widget assigned a cell according
to the options to grid
. To create
a grid, create a frame packed inside the parent window and then grid
the widgets within the frame.
You can specify explicit rows and columns using options to
grid
. However, if several widgets
are meant to appear in the same row, you can use a single grid
command with a list of widgets rather
than calling grid
for each one.
The first widget invokes the grid
command, and all other widgets for that column are specified as
options to grid
. Any subsequent
grid
commands increment the row
by one and start again.
You can use special characters as placeholders:
-
(minus sign)The previous widget should span this column as well. May not follow
^
orx
.x
Leaves a blank space.
^
The widget above this one (same column, previous row) should span this row.
Options to grid
are:
-column =>
n
The column in which to place the widget.
n
is any integer >= 0.-row =>
m
The row in which to place the widget.
m
is any integer >= 0.-columnspan =>
n
The number of columns for the widget to span, beginning with the column specified with
-column
.n
is any integer > 0.-rowspan =>
m
The number of rows for the widget to span, beginning with the row specified with
-row
.m
is any integer > 0.-sticky =>
sides
Sticks widget to specified side(s).
sides
contains ...
Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.