The widget class is a base class for all widgets and not designed to be instantiated directly.
Widget(id=None, style=None, **config)¶
This is the base widget implementation that all widgets in Toga derive from.
It defines the interface for core functionality for children, styling, layout and ownership by specific App and Window.
Apart from the above, this is an abstract implementation which must be made concrete by some platform-specific code for the _apply_layout method.
- 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.
Add a widget as a child of this one.
ValueErrorif this widget is a leaf, and cannot have children.
Parameters: child (
toga.Widget) – The child to add to the widget
The App to which this widget belongs.
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
Hide the widget from the super view.
The node identifier. This id can be used to target CSS directives
The parent of this node.
Set a font on this widget.
Parameters: font (
toga.Font) – The new font
Show the widget on the super view.
The style object for this widget.
Returns: The style for this widget Return type:
The Window to which this widget belongs.
- id (