From 61e52758f1e30a30e0095b5885a336e16b686408 Mon Sep 17 00:00:00 2001 From: Vishal Pankaj Chandratreya <19171016+tfpf@users.noreply.github.com> Date: Sat, 7 Sep 2024 13:21:16 +0530 Subject: [PATCH] Show scrollbars when handling scroll events Rather than when calling the handlers. This ensures they are shown even when resizing the window. --- src/ScrollableContainers/_tk.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ScrollableContainers/_tk.py b/src/ScrollableContainers/_tk.py index 30aabc3..903b7a4 100644 --- a/src/ScrollableContainers/_tk.py +++ b/src/ScrollableContainers/_tk.py @@ -129,6 +129,7 @@ def _xview(self, *args, width: int | None = None): # supported (because the Tcl/Tk manual pages say that it must be a # fraction between 0 and 1), but it works! self._canvas.xview_moveto((1 - width / self._frame.winfo_width()) / 2) + self._peek_scrollbars() def _yview(self, *args): """ @@ -139,6 +140,7 @@ def _yview(self, *args): """ if self._canvas.yview() != (0.0, 1.0): self._canvas.yview(*args) + self._peek_scrollbars() def _configure_viewport_explicit(self, event: tk.Event): """ @@ -227,4 +229,3 @@ def _scroll_viewport(self, event: tk.Event): case _: message = f"event {event.num} on OS {_system!r} is not supported" raise ValueError(message) - self._peek_scrollbars()