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