A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/094552.html below:

Can you capture Key-Release events in Tkinter?

Can you capture Key-Release events in Tkinter? 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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4