1place(n) Tk Built-In Commands place(n)
2
3
4
5______________________________________________________________________________
6
8 place - Geometry manager for fixed or rubber-sheet placement
9
11 place option arg ?arg ...?
12______________________________________________________________________________
13
15 The placer is a geometry manager for Tk. It provides simple fixed
16 placement of windows, where you specify the exact size and location of
17 one window, called the slave, within another window, called the master.
18 The placer also provides rubber-sheet placement, where you specify the
19 size and location of the slave in terms of the dimensions of the mas‐
20 ter, so that the slave changes size and location in response to changes
21 in the size of the master. Lastly, the placer allows you to mix these
22 styles of placement so that, for example, the slave has a fixed width
23 and height but is centered inside the master.
24
25 place window option value ?option value ...?
26 Arrange for the placer to manage the geometry of a slave whose
27 pathName is window. The remaining arguments consist of one or
28 more option-value pairs that specify the way in which window's
29 geometry is managed. Option may have any of the values accepted
30 by the place configure command.
31
32 place configure window ?option? ?value option value ...?
33 Query or modify the geometry options of the slave given by win‐
34 dow. If no option is specified, this command returns a list
35 describing the available options (see Tk_ConfigureInfo for
36 information on the format of this list). If option is specified
37 with no value, then the command returns a list describing the
38 one named option (this list will be identical to the correspond‐
39 ing sublist of the value returned if no option is specified).
40 If one or more option-value pairs are specified, then the com‐
41 mand modifies the given option(s) to have the given value(s); in
42 this case the command returns an empty string.
43
44 The following option-value pairs are supported:
45
46 -anchor where
47 Where specifies which point of window is to be positioned
48 at the (x,y) location selected by the -x, -y, -relx, and
49 -rely options. The anchor point is in terms of the outer
50 area of window including its border, if any. Thus if
51 where is se then the lower-right corner of window's bor‐
52 der will appear at the given (x,y) location in the mas‐
53 ter. The anchor position defaults to nw.
54
55 -bordermode mode
56 Mode determines the degree to which borders within the
57 master are used in determining the placement of the
58 slave. The default and most common value is inside. In
59 this case the placer considers the area of the master to
60 be the innermost area of the master, inside any border:
61 an option of -x 0 corresponds to an x-coordinate just
62 inside the border and an option of -relwidth 1.0 means
63 window will fill the area inside the master's border.
64
65 If mode is outside then the placer considers the area of
66 the master to include its border; this mode is typically
67 used when placing window outside its master, as with the
68 options -x 0 -y 0 -anchor ne. Lastly, mode may be speci‐
69 fied as ignore, in which case borders are ignored: the
70 area of the master is considered to be its official X
71 area, which includes any internal border but no external
72 border. A bordermode of ignore is probably not very use‐
73 ful.
74
75 -height size
76 Size specifies the height for window in screen units
77 (i.e. any of the forms accepted by Tk_GetPixels). The
78 height will be the outer dimension of window including
79 its border, if any. If size is an empty string, or if no
80 -height or -relheight option is specified, then the
81 height requested internally by the window will be used.
82
83 -in master
84 Master specifies the path name of the window relative to
85 which window is to be placed. Master must either be win‐
86 dow's parent or a descendant of window's parent. In
87 addition, master and window must both be descendants of
88 the same top-level window. These restrictions are neces‐
89 sary to guarantee that window is visible whenever master
90 is visible. If this option is not specified then the
91 master defaults to window's parent.
92
93 -relheight size
94 Size specifies the height for window. In this case the
95 height is specified as a floating-point number relative
96 to the height of the master: 0.5 means window will be
97 half as high as the master, 1.0 means window will have
98 the same height as the master, and so on. If both
99 -height and -relheight are specified for a slave, their
100 values are summed. For example, -relheight 1.0 -height
101 -2 makes the slave 2 pixels shorter than the master.
102
103 -relwidth size
104 Size specifies the width for window. In this case the
105 width is specified as a floating-point number relative to
106 the width of the master: 0.5 means window will be half as
107 wide as the master, 1.0 means window will have the same
108 width as the master, and so on. If both -width and -rel‐
109 width are specified for a slave, their values are summed.
110 For example, -relwidth 1.0 -width 5 makes the slave 5
111 pixels wider than the master.
112
113 -relx location
114 Location specifies the x-coordinate within the master
115 window of the anchor point for window. In this case the
116 location is specified in a relative fashion as a float‐
117 ing-point number: 0.0 corresponds to the left edge of
118 the master and 1.0 corresponds to the right edge of the
119 master. Location need not be in the range 0.0-1.0. If
120 both -x and -relx are specified for a slave then their
121 values are summed. For example, -relx 0.5 -x -2 posi‐
122 tions the left edge of the slave 2 pixels to the left of
123 the center of its master.
124
125 -rely location
126 Location specifies the y-coordinate within the master
127 window of the anchor point for window. In this case the
128 value is specified in a relative fashion as a floating-
129 point number: 0.0 corresponds to the top edge of the
130 master and 1.0 corresponds to the bottom edge of the mas‐
131 ter. Location need not be in the range 0.0-1.0. If both
132 -y and -rely are specified for a slave then their values
133 are summed. For example, -rely 0.5 -x 3 positions the
134 top edge of the slave 3 pixels below the center of its
135 master.
136
137 -width size
138 Size specifies the width for window in screen units (i.e.
139 any of the forms accepted by Tk_GetPixels). The width
140 will be the outer width of window including its border,
141 if any. If size is an empty string, or if no -width or
142 -relwidth option is specified, then the width requested
143 internally by the window will be used.
144
145 -x location
146 Location specifies the x-coordinate within the master
147 window of the anchor point for window. The location is
148 specified in screen units (i.e. any of the forms accepted
149 by Tk_GetPixels) and need not lie within the bounds of
150 the master window.
151
152 -y location
153 Location specifies the y-coordinate within the master
154 window of the anchor point for window. The location is
155 specified in screen units (i.e. any of the forms accepted
156 by Tk_GetPixels) and need not lie within the bounds of
157 the master window.
158
159 If the same value is specified separately with two different
160 options, such as -x and -relx, then the most recent option is
161 used and the older one is ignored.
162
163 place forget window
164 Causes the placer to stop managing the geometry of window. As a
165 side effect of this command window will be unmapped so that it
166 does not appear on the screen. If window is not currently man‐
167 aged by the placer then the command has no effect. This command
168 returns an empty string.
169
170 place info window
171 Returns a list giving the current configuration of window. The
172 list consists of option-value pairs in exactly the same form as
173 might be specified to the place configure command.
174
175 place slaves window
176 Returns a list of all the slave windows for which window is the
177 master. If there are no slaves for window then an empty string
178 is returned.
179
180 If the configuration of a window has been retrieved with place info,
181 that configuration can be restored later by first using place forget to
182 erase any existing information for the window and then invoking place
183 configure with the saved information.
184
186 It is not necessary for the master window to be the parent of the slave
187 window. This feature is useful in at least two situations. First, for
188 complex window layouts it means you can create a hierarchy of subwin‐
189 dows whose only purpose is to assist in the layout of the parent. The
190 “real children” of the parent (i.e. the windows that are significant
191 for the application's user interface) can be children of the parent yet
192 be placed inside the windows of the geometry-management hierarchy.
193 This means that the path names of the “real children” do not reflect
194 the geometry-management hierarchy and users can specify options for the
195 real children without being aware of the structure of the geometry-man‐
196 agement hierarchy.
197
198 A second reason for having a master different than the slave's parent
199 is to tie two siblings together. For example, the placer can be used
200 to force a window always to be positioned centered just below one of
201 its siblings by specifying the configuration
202 -in sibling -relx 0.5 -rely 1.0 -anchor n -bordermode outside
203 Whenever the sibling is repositioned in the future, the slave will be
204 repositioned as well.
205
206 Unlike many other geometry managers (such as the packer) the placer
207 does not make any attempt to manipulate the geometry of the master win‐
208 dows or the parents of slave windows (i.e. it does not set their
209 requested sizes). To control the sizes of these windows, make them
210 windows like frames and canvases that provide configuration options for
211 this purpose.
212
214 Make the label occupy the middle bit of the toplevel, no matter how it
215 is resized:
216 label .l -text "In the\nMiddle!" -bg black -fg white
217 place .l -relwidth .3 -relx .35 -relheight .3 -rely .35
218
220 grid(n), pack(n)
221
223 geometry manager, height, location, master, place, rubber sheet, slave,
224 width
225
226
227
228Tk place(n)