The '''place''' [geometry manager] allows for laying out widgets inside a master with absolute or relative locations and sizes. It does ''not'' do [geometry propagation], unlike [grid] and [pack].
<
>
http://www.tcl.tk/man/tcl8.6/TkCmd/place.htm
: '''place''' ''window option value'' ?''option value ...''?
: '''[place configure]''' ''window'' ?''option''? ?''value option value ...''?
: '''[place forget]''' ''window''
: '''[place info]''' ''window''
: '''[place slaves]''' ''window''
Arrange for the placer to manage the geometry of a slave whose pathName is ''window''.
The remaining arguments consist of one or more ''option-value'' pairs that specify the way in which ''window'' 's geometry is managed. ''Option'' may have any of the values accepted by the [place configure] command.
<>
place is the most beautiful & flexible of the [Geometry managers] supported by [Tk].
It provides support for fixed or "rubber-sheet" placement of widgets.
----
[[Any examples of how to use it, or tips on things to do or not do?]]
----
I have an example on using place that I want to share, since it demontrates some valuable uses of this geometry manager (especially for resizing windows). I apologize for the missing commands. This script is only runnable in order to show how resizing the main window affects the buttons etc. I will clean it up later I hope. Egil
======
#
# Three horizontal frames stacked on top of each other:
#
set c_height 0.8
set d_height 0.8
frame .c -background white
frame .m
frame .d
place .c -relx 0 -rely 0 -height ${c_height}c -relwidth 1.0 -width -0.5c
place .m -relx 0 -y ${c_height}c -relheight 1.0 -height -[expr {$c_height + $d_height}]c -relwidth 1.0
place .d -relx 0 -rely 1.0 -y -${d_height}c -height ${d_height}c -relwidth 1.0
#
# Top frame: Command buttons (to the left) and tabs (to the right):
#
button .c.open -text "Open" -command open_bufr
button .c.getdata -text "Retrieve" -command get_data
button .c.exit -text "Exit" -command exit_app
pack .c.open .c.getdata .c.exit -side left
button .c.data -text "Data" -relief flat -bg grey -command "tabraise data"
button .c.overview -text "Overview" -relief flat -bg grey -command "tabraise overview"
button .c.options -text "Options" -relief flat -bg grey -command "tabraise options"
button .c.help -text "Help" -relief flat -bg LightGreen -command "tabraise help"
pack .c.help .c.options .c.data .c.overview -side right -fill x -expand no
#
# Middle frame: Four frames that is raised by pushing tabs above:
#
frame .m.fd -background LightGreen
place .m.fd -relx 0 -rely 0 -relwidth 1.0 -relheight 1.0
frame .m.fo -background LightGreen
place .m.fo -relx 0 -rely 0 -relwidth 1.0 -relheight 1.0
frame .m.hlp -background LightGreen
place .m.hlp -relx 0 -rely 0 -relwidth 1.0 -relheight 1.0
frame .m.opt -background LightGreen
place .m.opt -relx 0 -rely 0 -relwidth 1.0 -relheight 1.0
#
# Help text:
#
set helpfont [font create -family helvetica -size 14 -weight bold]
label .m.hlp.l -bg white -justify left -font $helpfont -text {
--- Some help text ---
}
place .m.hlp.l -x 2c -y 1c -relwidth 1.0 -width -4c -relheight 1.0 -height -2c
raise .m.hlp
label .d.messages -textvariable bottom_message -relief raised -width 200 -anchor w
set bottom_message "BUFR file viewer"
pack .d.messages -side left -expand yes
wm geometry . 1200x640+50+50
======
----
See also:
* [grid]
* [pack]
----
***Screenshots***
[http://farm5.static.flickr.com/4067/4692923853_9ba9741186.jpg]
[gold] added pix
<>
<> Tk syntax help | Arts and Crafts of Tcl-Tk Programming | Geometry Managers | Command | GUI