Skip to content

Commit

Permalink
feat: Mouse wheel scrolling enabled for extensions list
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlin7 committed Mar 29, 2024
1 parent 2a98efa commit 083b8df
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion biscuit/core/components/utils/scrollableframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,17 @@ def __init__(self, master, *args, **kwargs) -> None:

self.content.bind("<Configure>", self._scroll)
self.canvas.bind("<Configure>", self._configure_canvas)

self.canvas.bind_all("<MouseWheel>", 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)
Expand Down

0 comments on commit 083b8df

Please sign in to comment.