1pack-old(n) Tk Built-In Commands pack-old(n)
2
3
4
5______________________________________________________________________________
6
8 pack-old - Obsolete syntax for packer geometry manager
9
11 pack after sibling window options ?window options ...?
12
13 pack append parent window options ?window options ...?
14
15 pack before sibling window options ?window options ...?
16
17 pack unpack window
18_________________________________________________________________
19
20
22 Note: this manual entry describes the syntax for the pack command as it
23 existed before Tk version 3.3. Although this syntax continues to be
24 supported for backward compatibility, it is obsolete and should not be
25 used anymore. At some point in the future it may cease to be sup‐
26 ported.
27
28 The packer is a geometry manager that arranges the children of a parent
29 by packing them in order around the edges of the parent. The first
30 child is placed against one side of the window, occupying the entire
31 span of the window along that side. This reduces the space remaining
32 for other children as if the side had been moved in by the size of the
33 first child. Then the next child is placed against one side of the
34 remaining cavity, and so on until all children have been placed or
35 there is no space left in the cavity.
36
37 The before, after, and append forms of the pack command are used to
38 insert one or more children into the packing order for their parent.
39 The before form inserts the children before window sibling in the
40 order; all of the other windows must be siblings of sibling. The
41 after form inserts the windows after sibling, and the append form
42 appends one or more windows to the end of the packing order for parent.
43 If a window named in any of these commands is already packed in its
44 parent, it is removed from its current position in the packing order
45 and repositioned as indicated by the command. All of these commands
46 return an empty string as result.
47
48 The unpack form of the pack command removes window from the packing
49 order of its parent and unmaps it. After the execution of this command
50 the packer will no longer manage window's geometry.
51
52 The placement of each child is actually a four-step process; the
53 options argument following each window consists of a list of one or
54 more fields that govern the placement of that window. In the discus‐
55 sion below, the term cavity refers to the space left in a parent when a
56 particular child is placed (i.e. all the space that was not claimed by
57 earlier children in the packing order). The term parcel refers to the
58 space allocated to a particular child; this is not necessarily the
59 same as the child window's final geometry.
60
61 The first step in placing a child is to determine which side of the
62 cavity it will lie against. Any one of the following options may be
63 used to specify a side:
64
65 top Position the child's parcel against the top of the cavity, occu‐
66 pying the full width of the cavity.
67
68 bottom Position the child's parcel against the bottom of the cavity,
69 occupying the full width of the cavity.
70
71 left Position the child's parcel against the left side of the cavity,
72 occupying the full height of the cavity.
73
74 right Position the child's parcel against the right side of the cav‐
75 ity, occupying the full height of the cavity.
76
77 At most one of these options should be specified for any given window.
78 If no side is specified, then the default is top.
79
80 The second step is to decide on a parcel for the child. For top and
81 bottom windows, the desired parcel width is normally the cavity width
82 and the desired parcel height is the window's requested height, as
83 passed to Tk_GeometryRequest. For left and right windows, the desired
84 parcel height is normally the cavity height and the desired width is
85 the window's requested width. However, extra space may be requested
86 for the window using any of the following options:
87
88 padx num Add num pixels to the window's requested width before com‐
89 puting the parcel size as described above.
90
91 pady num Add num pixels to the window's requested height before com‐
92 puting the parcel size as described above.
93
94 expand This option requests that the window's parcel absorb any
95 extra space left over in the parent's cavity after packing
96 all the children. The amount of space left over depends on
97 the sizes requested by the other children, and may be zero.
98 If several windows have all specified expand then the extra
99 width will be divided equally among all the left and right
100 windows that specified expand and the extra height will be
101 divided equally among all the top and bottom windows that
102 specified expand.
103
104 If the desired width or height for a parcel is larger than the corre‐
105 sponding dimension of the cavity, then the cavity's dimension is used
106 instead.
107
108 The third step in placing the window is to decide on the window's width
109 and height. The default is for the window to receive either its
110 requested width and height or the those of the parcel, whichever is
111 smaller. If the parcel is larger than the window's requested size,
112 then the following options may be used to expand the window to par‐
113 tially or completely fill the parcel:
114
115 fill Set the window's size to equal the parcel size.
116
117 fillx Increase the window's width to equal the parcel's width, but
118 retain the window's requested height.
119
120 filly Increase the window's height to equal the parcel's height, but
121 retain the window's requested width.
122
123 The last step is to decide the window's location within its parcel. If
124 the window's size equals the parcel's size, then the window simply
125 fills the entire parcel. If the parcel is larger than the window, then
126 one of the following options may be used to specify where the window
127 should be positioned within its parcel:
128
129 frame center Center the window in its parcel. This is the default if
130 no framing option is specified.
131
132 frame n Position the window with its top edge centered on the
133 top edge of the parcel.
134
135 frame ne Position the window with its upper-right corner at the
136 upper-right corner of the parcel.
137
138 frame e Position the window with its right edge centered on the
139 right edge of the parcel.
140
141 frame se Position the window with its lower-right corner at the
142 lower-right corner of the parcel.
143
144 frame s Position the window with its bottom edge centered on the
145 bottom edge of the parcel.
146
147 frame sw Position the window with its lower-left corner at the
148 lower-left corner of the parcel.
149
150 frame w Position the window with its left edge centered on the
151 left edge of the parcel.
152
153 frame nw Position the window with its upper-left corner at the
154 upper-left corner of the parcel.
155
156 The packer manages the mapped/unmapped state of all the packed children
157 windows. It automatically maps the windows when it packs them, and it
158 unmaps any windows for which there was no space left in the cavity.
159
160 The packer makes geometry requests on behalf of the parent windows it
161 manages. For each parent window it requests a size large enough to
162 accommodate all the options specified by all the packed children, such
163 that zero space would be leftover for expand options.
164
165
167 geometry manager, location, packer, parcel, size
168
169
170
171Tk 4.0 pack-old(n)