Python: Scrolling with mouse wheel in a textbox while mouse curser is not in the textbox (tkinter) Python: Scrolling with mouse wheel in a textbox while mouse curser is not in the textbox (tkinter) tkinter tkinter

Python: Scrolling with mouse wheel in a textbox while mouse curser is not in the textbox (tkinter)


I am also a newbie and this is my first post. But I had the same error and solved it pretty easily.

The error message you posted said it expected an integer but got something else, a float ("1.0"). So you need to ensure that the result of "-1*(event.delta/120)" is an integer, not a float. So your new code for your function mousewheel would look like this:

def mousewheel(event):    textbox.yview_scroll(int(-1*(event.delta/120)), "units")