import Tkinterfrom Tkinter import *root = Tk()prompt='Press a key'L = Label(root, text=prompt, width=len(prompt))L.pack()def key(event): if event.char==event.keysym: msg ='Normal Key %r' % event.char elif len(event.char)==1: msg ='Punctuation Key %r (%r)' % (event.keysym, event.char) else: msg ='Special Key %r' % event.keysym L.config(text=msg)L.bind_all('<Key>', key)root.mainloop()
Name (required)
email (will not be published) (required)
Website