Apr-04-2021, 10:42 PM
I'm guessing you mean that things move when you spin the mouse wheel. The reason this happens is because your code includes this:
A scrollbar is smart. It knows when to enable/disable the thumb, resize the thumb, position the thumb. It knows what to do when the scroll window is smaller or larger than the view window. Your event code is not smart. You spin the mouse wheel and it scrolls. If you want the mouse wheel to be smart, maybe it should work through the scrollbar.
def _on_mousewheel(self, event: tk.Event): self.canvas.yview_scroll(int(-1*(event.delta/120)), "units")If you tell the canvas to scroll, shouldn't it scroll?
A scrollbar is smart. It knows when to enable/disable the thumb, resize the thumb, position the thumb. It knows what to do when the scroll window is smaller or larger than the view window. Your event code is not smart. You spin the mouse wheel and it scrolls. If you want the mouse wheel to be smart, maybe it should work through the scrollbar.