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:
[code=python]
class ScrolledList(Fr ame):
def __init__(self, parent = None):
Frame.__init__( self, parent)
self.box = Listbox(self)
... more code ...
self.box.bind(" <MouseWheel>" , self.wheelscrol l)
def wheelscroll(sel f, event):
if event.delta > 0:
self.box.yview_ scroll(-2, 'units')
else:
self.box.yview_ scroll(2, 'units')
[/code]
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?
[code=python]
class ScrolledList(Fr ame):
def __init__(self, parent = None):
Frame.__init__( self, parent)
self.box = Listbox(self)
... more code ...
self.box.bind(" <MouseWheel>" , self.wheelscrol l)
def wheelscroll(sel f, event):
if event.delta > 0:
self.box.yview_ scroll(-2, 'units')
else:
self.box.yview_ scroll(2, 'units')
[/code]
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?
Comment