I have a class that I use for a scrolled list. The problem is I want to be able to scroll the list using the mouse wheel. I am using bind and it's not working:
-
class ScrolledList(Frame):
-
def __init__(self, parent = None):
-
Frame.__init__(self, parent)
-
self.box = Listbox(self)
-
... more code ...
-
-
self.box.bind("<MouseWheel>", self.wheelscroll)
-
-
def wheelscroll(self, event):
-
if event.delta > 0:
-
self.box.yview_scroll(-2, 'units')
-
else:
-
self.box.yview_scroll(2, 'units')
-
I also tried binding to the Frame but that doesn't work. I think the problem is the box isn't getting the messages, but then what should I bind to? Also, If I don't bind to the box, what happens if I have more than one scrolled list in one frame?