bindings in Tkinter

Jeff Epler jepler at
Mon Jun 14 15:35:56 CEST 2004

The following program just fine for me, printing "Control-N"
multiple times without the need to release and re-press control each
    from Tkinter import Tk
    t = Tk()
    def puts(s): print s
    t.bind("<Key-Control_L>", lambda e: puts("Control"))
    t.bind("<Key-Control_R>", lambda e: puts("Control"))
    t.bind("<KeyRelease-Control_L>", lambda e: puts("Released Control"))
    t.bind("<KeyRelease-Control_R>", lambda e: puts("Released Control"))
    t.bind("<Control-n>", lambda e: puts("Control-N"))

Your problem must be because you've done something more complicated than
you've told us.  For instance, if your binding for <Control-n> creates
or destroys widgets, moves the input focus, etc., maybe something bad is

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <>

More information about the Python-list mailing list