Skip to content

Commit

Permalink
Expose animation callback in scroll methods (#2903)
Browse files Browse the repository at this point in the history
* Expose animation callback in scroll methods

* call on_complete after refresh
  • Loading branch information
jayghoshter authored Jul 17, 2023
1 parent ca8eb3d commit 256e8ad
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/textual/scroll_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def scroll_to(
duration: float | None = None,
easing: EasingFunction | str | None = None,
force: bool = False,
on_complete: CallbackType | None = None,
) -> None:
"""Scroll to a given (absolute) coordinate, optionally animating.
Expand All @@ -128,6 +129,7 @@ def scroll_to(
duration: Duration of animation, if `animate` is `True` and `speed` is `None`.
easing: An easing method for the scrolling animation.
force: Force scrolling even when prohibited by overflow styling.
on_complete: A callable to invoke when the animation is finished.
"""

self._scroll_to(
Expand All @@ -138,4 +140,5 @@ def scroll_to(
duration=duration,
easing=easing,
force=force,
on_complete=on_complete,
)
Loading

0 comments on commit 256e8ad

Please sign in to comment.