Tkinter bind single key

Laura Creighton lac at strakt.com
Tue Nov 6 07:16:01 EST 2001


Your problem is the the key with the + on it isn't called +.

If you have a linux system, you can look in 
/usr/X11R6/include/X11/keysymdef.h

to find out what something is called.  What you want is called plus, 
unless it is on the keypad in which case it is called KP_Add. You
probably want to bind both of them.

So bind it to <KeyPress-plus> and <KeyPress-KP_Add>.

By the way, this business of the key-on-the-keypad is not the same as the
key-not-on-the-keypad is a general problem.  If you are binding
to 1 2 3 then you will need to bind to KP_1 KP_2 KP_3 or else keypad
users will not be able to use the keypad, which will annoy them to no
end.

Laura Creighton




More information about the Python-list mailing list