Pack#
The pack geometry manager places a widget by stacking it against one side of its parent. This page is the method spec; Arranging widgets teaches when to reach for pack.
In ttkbootstrap pack (and pack_configure) return the widget, so
construction and placement can be chained.
The canonical upstream reference is the Tk pack manual page (Tcl 8.6).
Options#
Every option below is a keyword argument to pack().
Option |
Type |
Description |
|---|---|---|
|
|
The side of the remaining space the widget stacks against: |
|
|
Stretch the widget to fill its slot: |
|
|
Claim a share of the parent’s leftover space — the slot grows; pair
with |
|
|
Where the widget sits inside its slot when it does not fill it:
|
padxpady |
|
External space around the widget, in pixels. A |
ipadxipady |
|
Internal padding added to the widget’s own size, in pixels. |
beforeafter |
|
Insert the widget into the packing order relative to a sibling that is already packed. |
|
|
Pack inside a container other than the parent (the container must be the parent or one of its descendants). Rarely needed. |
Methods#
- pack(**options)
Place the widget against a side of its parent, using the options above. Alias:
pack_configure.- Returns:
the widget (ttkbootstrap), for chaining.
- pack_forget()
Unmap the widget; it keeps existing and can be re-packed later.
- Returns:
None.
- pack_info()
Return the widget’s current pack options.
- Return type:
- pack_propagate(flag=None)
Get or set whether this container shrinks/grows to fit the widgets packed inside it. Call on the parent. Set
Falseto keep a fixed size regardless of children.- Parameters:
flag (bool) – the new setting; omit to query the current one.
- Returns:
the current setting when queried, else
None.
- pack_slaves()
Return the widgets this container manages with pack, in packing order. Call on the parent.
- Return type: