Box¶
The box is a generic container for any widgets, boxes leverage the layout model from the BeeWare Colosseum package.
Usage¶
A box can be instantiated with no children and then the children added later
import toga
box = toga.Box('box1')
button = toga.Button('Hello world', on_press=button_handler)
box.add(button)
To create boxes within boxes, use the children argument.
import toga
box_a = toga.Box('box_a')
box_b = toga.Box('box_b)
box = toga.Box('box', children=[box_a, box_b])
Box Styling¶
Styling of boxes through colosseum can be done pre instantiation or post,
import toga
box = toga.Box('box1')
box.style.set(flex_direction='column', padding_top=10)
import toga
from colosseum import CSS
style = CSS(padding_top=10)
box = toga.Box('box', style=style)
Supported Platforms¶
Component | iOS | win32 | web | django | cocoa | gtk | android |
---|---|---|---|---|---|---|---|
Box |