Split Container¶
The split container is a container with a movable split and the option for 2 or 3 elements.
Usage¶
import toga
split = toga.SplitContainer()
left_container = toga.Box()
right_container = toga.ScrollContainer()
split.content = [left_container, right_container]
Setting split direction¶
Split direction is set on instantiation using the direction keyword argument. Direction is vertical by default.
import toga
split = toga.SplitContainer()
left_container = toga.Box()
right_container = toga.ScrollContainer(direction=toga.ScrollContainer.HORIZONTAL)
split.content = [left_container, right_container]
Reference¶
-
class
toga.interface.widgets.splitcontainer.
SplitContainer
(id=None, style=None, direction=True, content=None)¶ Split container widget
Instantiate a new instance of the split container widget
Parameters: - id (
str
) – An identifier for this widget. - style (
colosseum.CSSNode
) – an optional style object. If no style is provided then a new one will be created for the widget. - direction (
bool
) – The direction for the container split, either SplitContainer.HORIZONTAL or SplitContainer.VERTICAL - content (
list
oftoga.Widget
) – The list of components to be split
-
HORIZONTAL
= False¶
-
VERTICAL
= True¶
-
add
(child)¶ Add a widget as a child of this one.
Raises an
ValueError
if this widget is a leaf, and cannot have children.Parameters: child ( toga.Widget
) – The child to add to the widget
-
app
¶ The App to which this widget belongs.
Return type: toga.App
-
children
¶ The children of this node.
This always returns a list, even if the node is a leaf and cannot have children.
Return type: list
Returns: A list of the children for this widget
-
content
¶ The content of the split container
Return type: list
oftoga.Widget
-
direction
¶ The direction of the split
Return type: bool
-
hide
()¶ Hide the widget from the super view.
-
id
¶ The node identifier. This id can be used to target CSS directives
Return type: str
-
on_resize
()¶
-
parent
¶ The parent of this node.
Return type: toga.Widget
-
set_font
(font)¶ Set a font on this widget.
Parameters: font ( toga.Font
) – The new font
-
show
()¶ Show the widget on the super view.
-
style
¶ The style object for this widget.
Returns: The style for this widget Return type: colosseum.CSSNode
-
window
¶ The Window to which this widget belongs.
Return type: toga.Window
- id (