1place(n)                     Tk Built-In Commands                     place(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       place - Geometry manager for fixed or rubber-sheet placement
9

SYNOPSIS

11       place option arg ?arg ...?
12_________________________________________________________________
13
14

DESCRIPTION

16       The  placer  is  a  geometry  manager for Tk.  It provides simple fixed
17       placement of windows, where you specify the exact size and location  of
18       one window, called the slave, within another window, called the master.
19       The placer also provides rubber-sheet placement, where you specify  the
20       size  and  location of the slave in terms of the dimensions of the mas‐
21       ter, so that the slave changes size and location in response to changes
22       in  the size of the master.  Lastly, the placer allows you to mix these
23       styles of placement so that, for example, the slave has a  fixed  width
24       and height but is centered inside the master.
25
26       place window option value ?option value ...?
27              Arrange  for  the placer to manage the geometry of a slave 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 slave given by win‐
35              dow.  If no option is specified, this  command  returns  a  list
36              describing  the  available  options  (see  Tk_ConfigureInfo  for
37              information 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 mas‐
54                     ter.  The anchor position defaults to nw.
55
56              -bordermode mode
57                     Mode determines the degree to which  borders  within  the
58                     master  are  used  in  determining  the  placement of the
59                     slave.  The default and most common value is inside.   In
60                     this  case the placer considers the area of the master to
61                     be the innermost area of the master, inside  any  border:
62                     an  option  of  -x  0 corresponds to an x-coordinate just
63                     inside the border and an option of  -relwidth  1.0  means
64                     window will fill the area inside the master's border.
65
66                     If  mode is outside then the placer considers the area of
67                     the master to include its border; this mode is  typically
68                     used  when placing window outside its master, as with the
69                     options -x 0 -y 0 -anchor ne.  Lastly, mode may be speci‐
70                     fied  as  ignore, in which case borders are ignored:  the
71                     area of the master is considered to  be  its  official  X
72                     area,  which includes any internal border but no external
73                     border.  A bordermode of ignore is probably not very use‐
74                     ful.
75
76              -height size
77                     Size  specifies  the  height  for  window in screen units
78                     (i.e. any of the forms accepted  by  Tk_GetPixels).   The
79                     height  will  be  the outer dimension of window including
80                     its border, if any.  If size is an empty string, or if no
81                     -height  or  -relheight  option  is  specified,  then the
82                     height requested internally by the window will be used.
83
84              -in master
85                     Master specifies the path name of the window relative  to
86                     which window is to be placed.  Master must either be win‐
87                     dow's parent or a  descendant  of  window's  parent.   In
88                     addition,  master  and window must both be descendants of
89                     the same top-level window.  These restrictions are neces‐
90                     sary  to guarantee that window is visible whenever master
91                     is visible.  If this option is  not  specified  then  the
92                     master defaults to window's parent.
93
94              -relheight size
95                     Size  specifies  the height for window.  In this case the
96                     height is specified as a floating-point  number  relative
97                     to  the  height  of  the master: 0.5 means window will be
98                     half as high as the master, 1.0 means  window  will  have
99                     the  same  height  as  the  master,  and  so on.  If both
100                     -height and -relheight are specified for a  slave,  their
101                     values  are  summed.  For example, -relheight 1.0 -height
102                     -2 makes the slave 2 pixels shorter than the master.
103
104              -relwidth size
105                     Size specifies the width for window.  In  this  case  the
106                     width is specified as a floating-point number relative to
107                     the width of the master: 0.5 means window will be half as
108                     wide  as  the master, 1.0 means window will have the same
109                     width as the master, and so on.  If both -width and -rel‐
110                     width are specified for a slave, their values are summed.
111                     For example, -relwidth 1.0 -width 5  makes  the  slave  5
112                     pixels wider than the master.
113
114              -relx location
115                     Location  specifies  the  x-coordinate  within the master
116                     window of the anchor point for window.  In this case  the
117                     location  is  specified in a relative fashion as a float‐
118                     ing-point number:  0.0 corresponds to the  left  edge  of
119                     the  master  and 1.0 corresponds to the right edge of the
120                     master.  Location need not be in the range  0.0-1.0.   If
121                     both  -x  and  -relx are specified for a slave then their
122                     values are summed.  For example, -relx 0.5  -x  -2  posi‐
123                     tions  the left edge of the slave 2 pixels to the left of
124                     the center of its master.
125
126              -rely location
127                     Location specifies the  y-coordinate  within  the  master
128                     window  of the anchor point for window.  In this case the
129                     value is specified in a relative fashion as  a  floating-
130                     point  number:   0.0  corresponds  to the top edge of the
131                     master and 1.0 corresponds to the bottom edge of the mas‐
132                     ter.  Location need not be in the range 0.0-1.0.  If both
133                     -y and -rely are specified for a slave then their  values
134                     are  summed.   For  example, -rely 0.5 -x 3 positions the
135                     top edge of the slave 3 pixels below the  center  of  its
136                     master.
137
138              -width size
139                     Size specifies the width for window in screen units (i.e.
140                     any of the forms accepted by  Tk_GetPixels).   The  width
141                     will  be  the outer width of window including its border,
142                     if any.  If size is an empty string, or if no  -width  or
143                     -relwidth  option  is specified, then the width requested
144                     internally by the window will be used.
145
146              -x location
147                     Location specifies the  x-coordinate  within  the  master
148                     window  of  the anchor point for window.  The location is
149                     specified in screen units (i.e. any of the forms accepted
150                     by  Tk_GetPixels)  and  need not lie within the bounds of
151                     the master window.
152
153              -y location
154                     Location specifies the  y-coordinate  within  the  master
155                     window  of  the anchor point for window.  The location is
156                     specified in screen units (i.e. any of the forms accepted
157                     by  Tk_GetPixels)  and  need not lie within the bounds of
158                     the master window.
159
160              If the same value is specified  separately  with  two  different
161              options,  such  as  -x and -relx, then the most recent option is
162              used and the older one is ignored.
163
164       place forget window
165              Causes the placer to stop managing the geometry of window.  As a
166              side  effect  of this command window will be unmapped so that it
167              does not appear on the screen.  If window is not currently  man‐
168              aged by the placer then the command has no effect.  This command
169              returns an empty string.
170
171       place info window
172              Returns a list giving the current configuration of window.   The
173              list  consists of option-value pairs in exactly the same form as
174              might be specified to the place configure command.
175
176       place slaves window
177              Returns a list of all the slave windows for which window is  the
178              master.   If there are no slaves for window then an empty string
179              is returned.
180
181       If the configuration of a window has been retrieved  with  place  info,
182       that configuration can be restored later by first using place forget to
183       erase any existing information for the window and then  invoking  place
184       configure with the saved information.
185

FINE POINTS

187       It is not necessary for the master window to be the parent of the slave
188       window.  This feature is useful in at least two situations.  First, for
189       complex  window  layouts it means you can create a hierarchy of subwin‐
190       dows whose only purpose is to assist in the layout of the parent.   The
191       “real  children”  of  the parent (i.e. the windows that are significant
192       for the application's user interface) can be children of the parent yet
193       be  placed  inside  the  windows  of the geometry-management hierarchy.
194       This means that the path names of the “real children”  do  not  reflect
195       the geometry-management hierarchy and users can specify options for the
196       real children without being aware of the structure of the geometry-man‐
197       agement hierarchy.
198
199       A  second  reason for having a master different than the slave's parent
200       is to tie two siblings together.  For example, the placer can  be  used
201       to  force  a  window always to be positioned centered just below one of
202       its siblings by specifying the configuration
203              -in sibling -relx 0.5 -rely 1.0 -anchor n -bordermode outside
204       Whenever the sibling is repositioned in the future, the slave  will  be
205       repositioned as well.
206
207       Unlike  many  other  geometry  managers (such as the packer) the placer
208       does not make any attempt to manipulate the geometry of the master win‐
209       dows  or  the  parents  of  slave  windows  (i.e. it does not set their
210       requested sizes).  To control the sizes of  these  windows,  make  them
211       windows like frames and canvases that provide configuration options for
212       this purpose.
213

EXAMPLE

215       Make the label occupy the middle bit of the toplevel, no matter how  it
216       is resized:
217              label .l -text "In the\nMiddle!" -bg black -fg white
218              place .l -relwidth .3 -relx .35 -relheight .3 -rely .35
219
220

SEE ALSO

222       grid(n), pack(n)
223
224

KEYWORDS

226       geometry manager, height, location, master, place, rubber sheet, slave,
227       width
228
229
230
231Tk                                                                    place(n)
Impressum