Skip to content

Scroll view

ScrollView is a base class for line api widgets.

ScrollView class

Bases: ScrollableContainer

A base class for a Widget that handles its own scrolling (i.e. doesn't rely on the compositor to render children).

is_scrollable property

is_scrollable: bool

Always scrollable.

refresh_line method

def refresh_line(self, y):

Refresh a single line.

Parameters
Parameter Default Description
y
int
required

Coordinate of line.

refresh_lines method

def refresh_lines(self, y_start, line_count=1):

Refresh one or more lines.

Parameters
Parameter Default Description
y_start
int
required

First line to refresh.

line_count
int
1

Total number of lines to refresh.

scroll_to method

def scroll_to(
    self,
    x=None,
    y=None,
    *,
    animate=True,
    speed=None,
    duration=None,
    easing=None,
    force=False,
    on_complete=None,
    level="basic"
):

Scroll to a given (absolute) coordinate, optionally animating.

Parameters
Parameter Default Description
x
float | None
None

X coordinate (column) to scroll to, or None for no change.

y
float | None
None

Y coordinate (row) to scroll to, or None for no change.

animate
bool
True

Animate to new scroll position.

speed
float | None
None

Speed of scroll if animate is True; or None to use duration.

duration
float | None
None

Duration of animation, if animate is True and speed is None.

easing
EasingFunction | str | None
None

An easing method for the scrolling animation.

force
bool
False

Force scrolling even when prohibited by overflow styling.

on_complete
CallbackType | None
None

A callable to invoke when the animation is finished.

level
AnimationLevel
'basic'

Minimum level required for the animation to take place (inclusive).