(I apologize if this posts twice. My AVG is being fussy.)
From what I've read, MouseWheel is a very tricky event. I have
replaced my Python tcl84.dll and tk84.dll files with those in the
ActiveTcl distribution to fix the crashes caused by the event. Then, I
managed to see that my test script (see code below) was registering the
event by printing the delta value (+/- 120).
-----------------
from Tkinter import *
def reportScroll(ev ent):
print "scrolled", event.delta, event
root = Tk()
myListbox = Listbox(root, selectmode=SING LE, height=10, width=20)
for x in range(30):
myListbox.inser t(END, x)
myListbox.pack( side=LEFT, expand=YES, fill=BOTH)
myScrollbar = Scrollbar(root, command=myListb ox.yview)
myScrollbar.bin d('<MouseWheel> ', reportScroll)
myScrollbar.foc us_set()
myScrollbar.pac k(side=RIGHT, fill=Y)
myListbox.confi g(yscrollcomman d=myScrollbar.s et)
root.mainloop()
-----------------
The scrollbar and listbox are tied together, but moving the wheelmouse
does nothing. I realize the code above doesn't give the event any real
duties, but I'm not really sure how to make that leap. How and to what
do I bind <WheelMouse> so that it will affect the listbox and the scrollbar?
From what I've read, MouseWheel is a very tricky event. I have
replaced my Python tcl84.dll and tk84.dll files with those in the
ActiveTcl distribution to fix the crashes caused by the event. Then, I
managed to see that my test script (see code below) was registering the
event by printing the delta value (+/- 120).
-----------------
from Tkinter import *
def reportScroll(ev ent):
print "scrolled", event.delta, event
root = Tk()
myListbox = Listbox(root, selectmode=SING LE, height=10, width=20)
for x in range(30):
myListbox.inser t(END, x)
myListbox.pack( side=LEFT, expand=YES, fill=BOTH)
myScrollbar = Scrollbar(root, command=myListb ox.yview)
myScrollbar.bin d('<MouseWheel> ', reportScroll)
myScrollbar.foc us_set()
myScrollbar.pac k(side=RIGHT, fill=Y)
myListbox.confi g(yscrollcomman d=myScrollbar.s et)
root.mainloop()
-----------------
The scrollbar and listbox are tied together, but moving the wheelmouse
does nothing. I realize the code above doesn't give the event any real
duties, but I'm not really sure how to make that leap. How and to what
do I bind <WheelMouse> so that it will affect the listbox and the scrollbar?
Comment