Tkinter: Listboxes, Keybindings?

Jonathan McLin jmclin at cox.net
Sat Mar 29 00:22:20 EST 2003


A number of questions, for which I've not found the answer in my Python
books nor on the web:

Why does the curselection method of an instance of Tkinter.Listbox return a
single element tuple rather than a scalar?
Why is this element a string rather than an int?


Key bindings do not work for me:

For my listbox:
    ...
    self.list=Listbox(self)    # self is a subclass of Frame.
    self.list.bind('<1>',self.ScrollUp)  # works
    self.list.bind('<Up>',self.ScrollUp)  # doesn't work
    self.list.bind('<2>',self.ScrollDown) # works
    self.list.bind('<Down>',self.ScrollDown)  # doesn't work
    ...

the bindings to <1> and <2> work (calling the bound methods on mouse
clicks), but the up and down arrow keys on the keyboard do not.  What am I
doing wrong?

Can someone direct me to examples of Tkinter wheel mouse events so I can
scroll based upon wheel rotation?

Thanks in advance,
Jon

PS: Python 2.2.2, TkVersion 8.3








More information about the Python-list mailing list