diff --git a/biscuit/core/components/utils/scrollableframe.py b/biscuit/core/components/utils/scrollableframe.py index 2de8784d..52cd9d96 100644 --- a/biscuit/core/components/utils/scrollableframe.py +++ b/biscuit/core/components/utils/scrollableframe.py @@ -26,13 +26,17 @@ def __init__(self, master, *args, **kwargs) -> None: self.content.bind("", self._scroll) self.canvas.bind("", self._configure_canvas) - + self.canvas.bind_all("", self._on_mousewheel) + def _scroll(self, _) -> None: self.canvas.configure(scrollregion=self.canvas.bbox("all")) def _configure_canvas(self, event) -> None: canvas_width = event.width self.canvas.itemconfig(self._content, width=canvas_width) + + def _on_mousewheel(self, event) -> None: + self.canvas.yview_scroll(int(-1 * (event.delta / 120)), "units") def add(self, content, *args, **kwargs) -> None: content.pack(in_=self.content, *args, **kwargs)