Skip to content

textual.scrollbar

Contains the widgets that manage Textual scrollbars.

Note

You will not typically need this for most apps.

ScrollBar

ScrollBar(vertical=True, name=None, *, thickness=1)

Bases: Widget

renderer class-attribute

renderer = ScrollBarRender

The class used for rendering scrollbars. This can be overridden and set to a ScrollBarRender-derived class in order to delegate all scrollbar rendering to that class. E.g.:

class MyScrollBarRender(ScrollBarRender): ...

app = MyApp()
ScrollBar.renderer = MyScrollBarRender
app.run()

Because this variable is accessed through specific instances (rather than through the class ScrollBar itself) it is also possible to set this on specific scrollbar instance to change only that instance:

my_widget.horizontal_scrollbar.renderer = MyScrollBarRender

action_grab

action_grab()

Begin capturing the mouse cursor.

action_scroll_down

action_scroll_down()

Scroll vertical scrollbars down, horizontal scrollbars right.

action_scroll_up

action_scroll_up()

Scroll vertical scrollbars up, horizontal scrollbars left.

ScrollBarCorner

ScrollBarCorner(name=None)

Bases: Widget

Widget which fills the gap between horizontal and vertical scrollbars, should they both be present.

ScrollBarRender

ScrollBarRender(
    virtual_size=100,
    window_size=0,
    position=0,
    thickness=1,
    vertical=True,
    style="bright_magenta on #555555",
)

BLANK_GLYPH class-attribute

BLANK_GLYPH = ' '

Glyph used for the main body of the scrollbar

HORIZONTAL_BARS class-attribute

HORIZONTAL_BARS = ['▉', '▊', '▋', '▌', '▍', '▎', '▏', ' ']

Glyphs used for horizontal scrollbar ends, for smoother display.

VERTICAL_BARS class-attribute

VERTICAL_BARS = ['▁', '▂', '▃', '▄', '▅', '▆', '▇', ' ']

Glyphs used for vertical scrollbar ends, for smoother display.

ScrollDown

ScrollDown()

Bases: ScrollMessage

Message sent when clicking below handle.

ScrollLeft

ScrollLeft()

Bases: ScrollMessage

Message sent when clicking above handle.

ScrollMessage

ScrollMessage()

Bases: Message

Base class for all scrollbar messages.

ScrollRight

ScrollRight()

Bases: ScrollMessage

Message sent when clicking below handle.

ScrollTo

ScrollTo(x=None, y=None, animate=True)

Bases: ScrollMessage

Message sent when click and dragging handle.

ScrollUp

ScrollUp()

Bases: ScrollMessage

Message sent when clicking above handle.