Tkinter Mousewheel Action For Scrolling On Canvas
I am new to python and I have an issue adding mouse scrolling action to my canvas.I have a vertical scrollbar.The scrollbar works fine when I manually scroll it, or mouse over it
Solution 1:
When you divide the result is a float. Try with integer division instead:
def _on_mousewheel(self, event):
self.canvas.yview_scroll(-1 * (event.delta // 120), "units")
here:--^
Now, you may want to check which widget the mouse pointer is hovering above because the _on_mousewheel()
function is invoked when the mouse pointer hovers on the scrollbar, making it scroll twice as fast.
Post a Comment for "Tkinter Mousewheel Action For Scrolling On Canvas"