Tidy up the docstring of Widget.scroll_relative

Delivering on a promise made in #1920.
This commit is contained in:
Dave Pearson
2023-03-01 14:22:34 +00:00
parent 21e7cfb9ca
commit 22b0b5b047

View File

@@ -1511,17 +1511,16 @@ class Widget(DOMNode):
"""Scroll relative to current position. """Scroll relative to current position.
Args: Args:
x: X distance (columns) to scroll, or ``None`` for no change. Defaults to None. x: X distance (columns) to scroll, or ``None`` for no change.
y: Y distance (rows) to scroll, or ``None`` for no change. Defaults to None. y: Y distance (rows) to scroll, or ``None`` for no change.
animate: Animate to new scroll position. Defaults to False. animate: Animate to new scroll position.
speed: Speed of scroll if animate is True. Or None to use duration. speed: Speed of scroll if animate is `True`. Or `None` to use duration.
duration: Duration of animation, if animate is True and speed is None. duration: Duration of animation, if animate is `True` and speed is `None`.
easing: An easing method for the scrolling animation. Defaults to "None", easing: An easing method for the scrolling animation.
which will result in Textual choosing the configured default scrolling easing function. force: Force scrolling even when prohibited by overflow styling.
force: Force scrolling even when prohibited by overflow styling. Defaults to `False`.
Returns: Returns:
True if the scroll position changed, otherwise False. `True` if the scroll position changed, otherwise `False`.
""" """
return self.scroll_to( return self.scroll_to(
None if x is None else (self.scroll_x + x), None if x is None else (self.scroll_x + x),