PackFrame
Bases: Frame
A Frame with simplified pack-based layout management.
PackFrame extends the bootstack Frame with automatic pack-based layout management, including support for direction, gap spacing, and default fill/expand behavior.
Children packed into this frame automatically receive the frame's
default layout options. Simply use the standard pack() method
on child widgets — no special add() method is needed.
Example
frame = PackFrame(direction="vertical", gap=10, fill_items="x")
Label(frame, text="First").pack()
Label(frame, text="Second").pack()
Button(frame, text="Click").pack(expand=True) # override default
__init__
__init__(
master: Master = None,
*,
direction: Direction = "vertical",
gap: int = 0,
fill_items: Optional[Fill] = None,
expand_items: Optional[bool] = None,
anchor_items: Optional[Anchor] = None,
propagate: Optional[bool] = None,
**kwargs: Any,
) -> None
Create a PackFrame with automatic pack-based layout.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
master
|
Master
|
Parent widget. If None, uses the default root window. |
None
|
direction
|
Direction
|
Layout direction — |
'vertical'
|
gap
|
int
|
Spacing between children in pixels. Defaults to 0. |
0
|
fill_items
|
Optional[Fill]
|
Default |
None
|
expand_items
|
Optional[bool]
|
Default |
None
|
anchor_items
|
Optional[Anchor]
|
Default |
None
|
propagate
|
Optional[bool]
|
If False, the frame will not resize to fit its contents. Defaults to None (Tk default behaviour). |
None
|
**kwargs
|
Any
|
Additional keyword arguments forwarded to |
{}
|