Tkinter bind single key

Prabhu Ramachandran prabhu at aero.iitm.ernet.in
Tue Nov 6 00:14:48 EST 2001


>>>>> "JH" == John Hunter <jdhunter at nitace.bsd.uchicago.edu> writes:

    JH> I am reading 'An Introduction to Tkinter' by Fredrik Lundh and
    JH> my read of Chapter 7 'Events and Bindings' is that this syntax

    JH>         self.__canvas.bind('+', self.zoomin)

Try the following instead:

self.__canvas.bind('<plus>', self.zoomin)
or
self.__canvas.bind('<KeyPress-plus>', self.zoomin)

Under Linux you can use the keysymdef.h file to see what the correct
names are its usually here:

     /usr/X11R6/include/X11/keysymdef.h

prabhu




More information about the Python-list mailing list