Skip to content

Commit

Permalink
Show scrollbars when handling scroll events
Browse files Browse the repository at this point in the history
Rather than when calling the handlers. This ensures they are shown even when resizing the window.
  • Loading branch information
tfpf committed Sep 7, 2024
1 parent 2213861 commit 61e5275
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ScrollableContainers/_tk.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand All @@ -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):
"""
Expand Down Expand Up @@ -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()

0 comments on commit 61e5275

Please sign in to comment.