The split container is a container with a movable split and the option for 2 or 3 elements.
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(direction=toga.SplitContainer.HORIZONTAL) left_container = toga.Box() right_container = toga.ScrollContainer() split.content = [left_container, right_container]
SplitContainer(id=None, style=None, direction=True, content=None, factory=None)¶
A SplitContainer displays two widgets vertically or horizontally next to each other with a movable divider.
- id (str) – An identifier for this widget.
- style (
Style) – An optional style object. If no style is provided then a new one will be created for the widget.
- direction – The direction for the container split, either SplitContainer.HORIZONTAL or SplitContainer.VERTICAL
- content (
toga.Widget) – The list of components to be split.
- factory (
module) – A python module that is capable to return a implementation of this class with the same name. (optional & normally not needed)
Add a node as a child of this one. :param child: A node to add as a child to this node.
ValueError– If this node is a leaf, and cannot have children.
The App to which this widget belongs. On setting the app we also iterate over all children of this widget and set them to the same app.
toga.Appto which this widget belongs.
ValueError– If the widget is already associated with another app.
Determine if the node can have children.
This does not resolve whether there actually are any children; it only confirms whether children are theoretically allowed.
The children of this node. This always returns a list, even if the node is a leaf and cannot have children.
Returns: A list of the children for this widget.
The sub layouts of the SplitContainer.
toga.Widget. Each element of the list is a sub layout of the SplitContainer
ValueError– If the list is less than two elements long.
The direction of the split
Returns: True if True for vertical, False for horizontal.
The node identifier. This id can be used to target styling directives
Returns: The widgets identifier as a
The parent of this node.
Returns: The parent of this node. Returns None if this node is the root node.
Refresh the layout and appearance of the tree this node is contained in.
Refresh the layout and appearance of this widget.
The root of the tree containing this node.
Returns: The root node. Returns self if this node is the root node.
The Window to which this widget belongs. On setting the window, we automatically update all children of this widget to belong to the same window.
toga.Windowto which the widget belongs.