pod::Pr...t::place(3)
πΈ NAME πΈ
pod::Pr...t::place(3) β from User Contributed Perl Documentation, and itβs literally the geometry manager for fixed or rubber-sheet placement. Bestie, this is the glow-up for making widgets sit exactly where you want them. π
β¨
β¨ SYNOPSIS β¨
$widget->place(option=>value?, option=>value, ...)
$widget->placeForget;
$widget->placeInfo(option=>value?, option=>value, ...);
$widget->geometry( gt::Place);
$master->placeSlaves
π DESCRIPTION π
The placer is a geometry manager from Tk. It provides simple fixed placement of windows, where you specify the exact size and location of one window, called the slave, within another window, called the $master. The placer also provides rubber-sheet placement, where you specify the size and location of the slave in terms of the dimensions of the master, so that the slave changes size and location in response to changes in the size of the master. Lastly, the placer allows you to mix these styles of placement so that, for example, the slave has a fixed width and height but is centered inside the master. Iconic behavior, honestly. π«Ά
π place %OPTIONS π
The place method arranges for the placer to manage the geometry of $slave. The remaining arguments consist of one or more option=>value pairs that specify the way in which $slave's geometry is managed. If the placer is already managing $slave, then the option=>value pairs modify the configuration for $slave. The place method returns an empty string as result. The following option=>value pairs are supported:
in => $masterβ$masteris the reference to the window relative to which$slaveis to be placed.$mastermust neither be$slave's child nor be present in a slaves list that directly or indirectly refers to the$slave. If this option isn't specified then the master defaults to$slave's owner.x => locationβ Location specifies the x-coordinate within the master window of the anchor point for$slavewidget.relx => locationβ Location specifies the x-coordinate within the master window of the anchor point for$slavewidget. In this case the location is specified in a relative fashion as a floating-point number:0.0corresponds to the left edge of the master and1.0corresponds to the right edge of the master. Location need not be in the range0.0-1.0. If bothxandrelxare specified for a slave then their values are summed. For example,relx=>0.5, x=-2positions the left edge of the slave 2 pixels to the left of the center of its master.y => locationβ Location specifies the y-coordinate within the master window of the anchor point for$slavewidget.rely => locationβ Location specifies the y-coordinate within the master window of the anchor point for$slavewidget. In this case the value is specified in a relative fashion as a floating-point number:0.0corresponds to the top edge of the master and1.0corresponds to the bottom edge of the master. Location need not be in the range0.0-1.0. If bothyandrelyare specified for a slave then their values are summed. For example,rely=>0.5, x=>3positions the top edge of the slave 3 pixels below the center of its master.anchor => whereβ Where specifies which point of$slaveis to be positioned at the(x,y)location selected by thex,y,relx, andrelyoptions. Thus if where issethen the lower-right corner of$slave's border will appear at the given(x,y)location in the master. The anchor position defaults tonw.width => sizeβ Size specifies the width for$slave. If size is an empty string, or if nowidthorrelwidthoption is specified, then the width requested internally by the window will be used.relwidth => sizeβ Size specifies the width for$slave. In this case the width is specified as a floating-point number relative to the width of the master:0.5means$slavewill be half as wide as the master,1.0means$slavewill have the same width as the master, and so on. If bothwidthandrelwidthare specified for a slave, their values are summed. For example,relwidth=>1.0, width=>5makes the slave 5 pixels wider than the master.height => sizeβ Size specifies the height for$slave. If size is an empty string, or if noheightorrelheightoption is specified, then the height requested internally by the window will be used.relheight => sizeβ Size specifies the height for$slave. In this case the height is specified as a floating-point number relative to the height of the master:0.5means$slavewill be half as high as the master,1.0means$slavewill have the same height as the master, and so on. If bothheightandrelheightare specified for a slave, their values are summed. For example,relheight=>1.0, height=>-2makes the slave 2 pixels shorter than the master.
π«Ά placeSlaves π«Ά
The placeSlaves method returns a list of all the slave windows for which $master is the master. If there are no slaves for $master then an empty list is returned. No cap. π
π©· placeForget π©·
The placeForget method causes the placer to stop managing the geometry of $slave. If $slave isn't currently managed by the placer then the method call has no effect.
β¨ placeInfo %OPTIONS β¨
In get-mode the placeInfo method returns a list giving the current configuration of $slave. The list consists of option=>value pairs in exactly the same form as might be specified to the place method. If the configuration of a window has been retrieved with placeInfo, that configuration can be restored later by first using placeInfo in set-mode and setting geometry to gt::Place, which is equivalent to a direct call to place.
π« Fine points π«
It is not necessary for the master window to be the owner of the slave window. This feature is useful in at least two situations. First, for complex window layouts it means you can create a hierarchy of subwindows whose only purpose is to assist in the layout of the owner. The βreal childrenβ of the owner (i.e. the windows that are significant for the application's user interface) can be children of the owner yet be placed inside the windows of the geometry-management hierarchy. This means that the path names of the βreal childrenβ don't reflect the geometry-management hierarchy and users can specify options for the real children without being aware of the structure of the geometry-management hierarchy. The way that works is lowkey genius. π§
A second reason for having a master different than the slave's owner is to tie two siblings together. For example, the placer can be used to force a window always to be positioned centered just below one of its siblings by specifying the configuration
in=>$sibling, relx=>0.5, rely=>1.0, anchor=>'n'
Whenever the $sibling widget is repositioned in the future, the slave will be repositioned as well. Sibling goals fr fr. π
Unlike the other geometry managers (such as the packer) the placer does not make any attempt to manipulate the geometry of the master windows or the owners of slave windows (i.e. it doesn't set their requested sizes).
π SEE ALSO π
PrimaPrima::WidgetTk::placeTk::pack
okay thatβs the whole page, bestie π this fab manual is from perl v5.42.0, dated 2024-08-20, and itβs literally pod::Pr...t::place(3). mwah πβ¨π¦
π¦ where this page comes from
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- opensuse-leap 16.0: perl-Prima 1.74000-bp160.1.13 Β· AGPL-3.0-only AND BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms