Bind scroll events to a specific widget and its children.
(self, widget)
| 519 | self._bind_scroll_to_widget(frame.get_content_frame()) |
| 520 | |
| 521 | def _bind_scroll_to_widget(self, widget) -> None: |
| 522 | """Bind scroll events to a specific widget and its children.""" |
| 523 | if platform.system() == "Linux": |
| 524 | widget.bind("<Button-4>", self._on_scroll_up, add="+") |
| 525 | widget.bind("<Button-5>", self._on_scroll_down, add="+") |
| 526 | else: |
| 527 | widget.bind("<MouseWheel>", self._on_mousewheel, add="+") |
| 528 | |
| 529 | # Recursively bind to children |
| 530 | for child in widget.winfo_children(): |
| 531 | self._bind_scroll_to_widget(child) |
| 532 | |
| 533 | def _on_mousewheel(self, event) -> Optional[str]: |
| 534 | """Handle mouse wheel on Windows/macOS.""" |