Skip to content

Commit 256e8ad

Browse files
authored
Expose animation callback in scroll methods (#2903)
* Expose animation callback in scroll methods * call on_complete after refresh
1 parent ca8eb3d commit 256e8ad

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

src/textual/scroll_view.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ def scroll_to(
117117
duration: float | None = None,
118118
easing: EasingFunction | str | None = None,
119119
force: bool = False,
120+
on_complete: CallbackType | None = None,
120121
) -> None:
121122
"""Scroll to a given (absolute) coordinate, optionally animating.
122123
@@ -128,6 +129,7 @@ def scroll_to(
128129
duration: Duration of animation, if `animate` is `True` and `speed` is `None`.
129130
easing: An easing method for the scrolling animation.
130131
force: Force scrolling even when prohibited by overflow styling.
132+
on_complete: A callable to invoke when the animation is finished.
131133
"""
132134

133135
self._scroll_to(
@@ -138,4 +140,5 @@ def scroll_to(
138140
duration=duration,
139141
easing=easing,
140142
force=force,
143+
on_complete=on_complete,
141144
)

0 commit comments

Comments
 (0)