ScrollContainer¶
A container that can display a layout larger than the area of the container, with overflow controlled by scroll bars.






Not supported
Usage¶
import toga
content = toga.Box(children=[...])
container = toga.ScrollContainer(content=content)
Reference¶
toga.ScrollContainer ¶
ScrollContainer(
id=None,
style=None,
horizontal=True,
vertical=True,
on_scroll=None,
content=None,
**kwargs,
)
Bases: Widget
Create a new Scroll Container.
| PARAMETER | DESCRIPTION |
|---|---|
id
|
The ID for the widget.
TYPE:
|
style
|
A style object. If no style is provided, a default style will be applied to the widget.
TYPE:
|
horizontal
|
Should horizontal scrolling be permitted?
TYPE:
|
vertical
|
Should vertical scrolling be permitted?
TYPE:
|
on_scroll
|
Initial
TYPE:
|
content
|
The content to display in the scroll window.
TYPE:
|
kwargs
|
Initial style properties.
DEFAULT:
|
enabled
property
writable
¶
enabled
Is the widget currently enabled? i.e., can the user interact with the widget?
ScrollContainer widgets cannot be disabled; this property will always return True; any attempt to modify it will be ignored.
horizontal_position
property
writable
¶
horizontal_position
The current horizontal scroll position.
If the value provided is negative, or greater than the maximum horizontal position, the value will be clipped to the valid range.
| RETURNS | DESCRIPTION |
|---|---|
int
|
The current horizontal scroll position. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If an attempt is made to change the horizontal position when horizontal scrolling is disabled. |
max_horizontal_position
property
¶
max_horizontal_position
The maximum horizontal scroll position (read-only).
max_vertical_position
property
¶
max_vertical_position
The maximum vertical scroll position (read-only).
position
property
writable
¶
position
The current scroll position.
If the value provided for either axis is negative, or greater than the maximum position in that axis, the value will be clipped to the valid range.
If scrolling is disabled in either axis, the value provided for that axis will be ignored.
vertical_position
property
writable
¶
vertical_position
The current vertical scroll position.
If the value provided is negative, or greater than the maximum vertical position, the value will be clipped to the valid range.
| RETURNS | DESCRIPTION |
|---|---|
int
|
The current vertical scroll position. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If an attempt is made to change the vertical position when vertical scrolling is disabled. |
toga.widgets.scrollcontainer.OnScrollHandler ¶
Bases: Protocol
__call__ ¶
__call__(widget, **kwargs)
A handler to invoke when the container is scrolled.
| PARAMETER | DESCRIPTION |
|---|---|
widget
|
The ScrollContainer that was scrolled.
TYPE:
|
kwargs
|
Ensures compatibility with arguments added in future versions.
TYPE:
|