bindings in Tkinter

p.kosina gen2n at seznam.cz
Wed Jun 16 00:58:37 EDT 2004


Solved.- I must have old documentation, I used '<Control_L>n'.
Thank you.
Pavel



Jeff Epler napsal(a):
> The following program just fine for me, printing "Control-N"
> multiple times without the need to release and re-press control each
> time:
>     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"))
>     t.mainloop()
> 
> 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
> happening.  
> 
> Jeff



More information about the Python-list mailing list