Constraints
Constraints declare how a widget sizes and positions itself relative to its parent.
from batFramework.gui.constraints import constraints as c
button = bf.gui.Button("Play")
button.add_constraints(
c.Width(200),
c.Height(40),
c.Center(),
)
scene.root.add(button)
Common constraints
Size: Width, Height, MinWidth, MinHeight, MaxWidth, MaxHeight, Fill, FillX, FillY, percentage variants
Position: Center, CenterX, CenterY, AnchorTop, AnchorBottom, AnchorLeft, AnchorRight, corner anchors, margins
Flex-like: GrowH, GrowV — distribute free space inside layouts
Other: AspectRatio
Constraints resolve during the widget update passes driven by Root.update_tree().