The place Geometry Manager

The place geometry manager lets you position a window at explicit x,y coordinates. With place, you can overlap widgets, which isn’t allowed with grid or pack. For example, to position a button widget at the upper-left corner of a window:

$button->place(-x => 0, -y => 0);

Options to place are:

-anchor => position

The position in the widget that will be placed at the coordinates specified. Values for position are n, ne, e, se, s, sw, w, nw, and center. Default is nw.

-bordermode => location

Determines whether the border portion of the widget is included in the coordinate system. Values for location are inside, outside, and ignore.

-height => amount

Absolute height of the widget. amount can be represented as a number followed by c (centimeters), i (inches), m (millimeters), and p (printer points). Pixels are the default units.

-in => $ window

The child widget will be packed inside the specified window instead of the parent that created it. Any relative coordinates or sizes will still refer to the parent.

-relheight => ratio

The height of the widget relates to the parent widget’s height by the specified ratio.

-relwidth => ratio

The width of the widget relates to the parent widget’s width by the specified ratio.

-relx => xratio

The widget will be placed relative to its parent by the specified ratio. xratiois a floating point number from 0.0 to 1.0, with 0.0 representing the left side of the parent widget and 1.0 representing the right side.

-rely => yratio

The widget will be ...

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.