I am having problems with the way that the right button gets its selection. I am not good with coordinates so i dont know how to reverse the way i am selecting. I would like to scroll the listbox selection the way the mouse is going, not the reverse like it is right now. I would simply like it to select the next item in the listbox when moving the mouse down/up.
from Tkinter import *
def _select(y):
row = lb.nearest(y)
lb.selection_clear(0, END)
lb.selection_set(row)
def _b2motion(x, y):
lb.scan_dragto(x, y)
_select(y)
return 'break'
root = Tk()
sb = Scrollbar(root)
lb =Listbox(root, width=20,yscrollcommand=sb.set)
lb.bind('<B3-Motion>', lambda e: _b2motion(e.x, e.y))
sb.config(command=lb.yview)
lb.grid(row=0,column=0)
sb.grid(row=0,column=1,sticky=N+S)
for x in range(50):
lb.insert(END, x)
mainloop()
If you flip the sign on the y in the motion box that will change the direction of scrolling. Divide by an integer if you need it slower, I liked 3.
I am not sure what the rest of your problem is… are you trying to replicate what the left button does with the right button?