Skip to content

textual.scroll_view

ScrollView is a base class for line api widgets.

ScrollView

ScrollView(
    *children,
    name=None,
    id=None,
    classes=None,
    disabled=False,
)

Bases: ScrollableContainer

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

Parameters:

Name Type Description Default

*children

Widget

Child widgets.

()

name

str | None

The name of the widget.

None

id

str | None

The ID of the widget in the DOM.

None

classes

str | None

The CSS classes for the widget.

None

disabled

bool

Whether the widget is disabled or not.

False

is_scrollable property

is_scrollable

Always scrollable.

refresh_line

refresh_line(y)

Refresh a single line.

Parameters:

Name Type Description Default

y

int

Coordinate of line.

required

refresh_lines

refresh_lines(y_start, line_count=1)

Refresh one or more lines.

Parameters:

Name Type Description Default

y_start

int

First line to refresh.

required

line_count

int

Total number of lines to refresh.

1

scroll_to

scroll_to(
    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:

Name Type Description Default

x

float | None

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

None

y

float | None

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

None

animate

bool

Animate to new scroll position.

True

speed

float | None

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

None

duration

float | None

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

None

easing

EasingFunction | str | None

An easing method for the scrolling animation.

None

force

bool

Force scrolling even when prohibited by overflow styling.

False

on_complete

CallbackType | None

A callable to invoke when the animation is finished.

None

level

AnimationLevel

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

'basic'