Scroll Container#
The Scroll Container is similar to the iframe or scrollable div element in HTML, it contains an object with its own scrollable selection.

Usage#
import toga
content = toga.WebView()
container = toga.ScrollContainer(content=content)
Scroll settings#
Horizontal or vertical scroll can be set via the initializer or using the property.
import toga
content = toga.WebView()
container = toga.ScrollContainer(content=content, horizontal=False)
container.vertical = False
Reference#
- class toga.widgets.scrollcontainer.ScrollContainer(id=None, style=None, horizontal=True, vertical=True, on_scroll=None, content=None, factory=None)#
Instantiate a new instance of the scrollable container widget.
- Parameters:
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.horizontal (bool) – If True enable horizontal scroll bar.
vertical (bool) – If True enable vertical scroll bar.
content (
Widget
) – The content of the scroll window.
- MIN_HEIGHT = 100#
- MIN_WIDTH = 100#
- property content#
Content of the scroll container.
- Returns:
The content of the widget (
Widget
).
- property horizontal#
Shows whether horizontal scrolling is enabled.
- Returns:
(bool) True if enabled, False if disabled.
- property horizontal_position#
- property on_scroll#
- refresh_sublayouts()#
Refresh the layout and appearance of this widget.
- property vertical#
Shows whether vertical scrolling is enabled.
- Returns:
(bool) True if enabled, False if disabled.
- property vertical_position#