Tk Listbox bindings (was: Tk Listbox Question)

Peter Funk pf at artcom0.north.de
Sun Dec 12 12:26:21 EST 1999


In <199912092219.XAA26417 at axil.hvision.nl> 
	"Hans Nowak" <ivnowa at hvision.nl> writes:
>>         #Here's the bindings
>> 
>>         self.listbox.bind('<Double-Button-1>', self.do_this)
>>         self.listbox.bind('<Control-Button-1>', self.do_that)
>>         self.listbox.bind('<Button-2>', self.do_something_else)

>While it's easy to bind mouse events to a listbox, I haven't managed 
>to bind keyboard events to it. In a current project I have a listbox 
>and I want my users to be able to scroll through it using common keys 
>like <Up> and <Down>. However, binding them to the listbox, as done 
>above, does not work; I don't know why.

May be because your listbox doesn't got the keyboard focus?
You can move around the keyboard focus using the TAB key or
otherwise you can set the keyboard focus using the 'focus_set()'
method from within your program.

Hope this helps.

Regards, Peter
-- 
Peter Funk, Oldenburger Str.86, D-27777 Ganderkesee, Germany, Fax:+49 4222950260
echo '[dO%O+38%O+PO/d0<0]Fi22os0CC4BA64E418CE7l0xAP'|dc



More information about the Python-list mailing list