Tkinter bind single key
jdhunter at nitace.bsd.uchicago.edu
Tue Nov 6 17:01:28 CET 2001
>>>>> "Prabhu" == Prabhu Ramachandran <prabhu at aero.iitm.ernet.in> writes:
Prabhu> self.__canvas.bind('<plus>', self.zoomin) or
Prabhu> self.__canvas.bind('<KeyPress-plus>', self.zoomin)
Thanks for the suggestions, and for the pointer to keysymdef.h.
Unfortunately, I am having no luck.
I am working with the key 'z' to simplify. All I want to do is bind
an event to the 'z' keypress. I have tried (without success):
Ditto for 'plus'
My keysymdef entries are:
#define XK_z 0x07a
#define XK_plus 0x02b
Here is the test script; the mouse binding works fine:
from Tkinter import *
print 'You pressed z'
print 'You pressed mouse-1'
root = Tk()
frame = Frame(root, width=500,height=500)
More information about the Python-list