Can you capture Key-Release events in Tkinter?
Fredrik Lundh
fredrik at pythonware.com
Tue Apr 24 12:44:00 EDT 2001
Nick Perkins wrote:
> I am trying to make a little interactive game using
> Tkinter Canvas widget. (Python 2.0 - win NT - PythonWin..)
>
> It seems that only KeyPress events are available, and not key-release
> events. Is this a limitation of Tk itself, or a limitation of Tkinter, or is
> there a way to do it?
this works for me:
from Tkinter import *
c = Canvas()
c.pack()
# make sure we see all keyboard events
c.focus_set()
def release(event):
print "release", event.keysym
c.bind("<KeyRelease>", release)
mainloop()
Cheers /F
More information about the Python-list
mailing list