@@ -0,0 +1,855 @@
+import Tkinter as tk%0A%0Aroot = tk.Tk()%0Aprompt = %22Click a button or press any key%22%0Alabel = tk.Label(root, text=prompt, width=len(prompt))%0Alabel.pack()%0A%0A%0Adef key(event):%0A    if event.char == event.keysym:%0A        msg = %22Normal Key %7B0!r%7D%22.format(event.char)%0A    elif len(event.char) == 1:%0A        msg = %22Punctuation Key %7B0!r%7D %7B1!r%7D%22.format(event.keysym, event.char)%0A    else:%0A        msg = %22Special Key %7B0!r%7D%22.format(event.keysym)%0A    label.config(text=msg)%0A%0Alabel.bind_all(%22%3CKey%3E%22, key)%0A%0Adef do_mouse(event_name):%0A%0A    def mouse_binding(event):%0A        msg = %22Mouse event %7B0!r%7D%22.format(event_name)%0A        label.config(text=msg)%0A%0A    label.bind_all(%22%3C%7B0%7D%3E%22.format(event_name), mouse_binding)%0A%0A%0Afor i in xrange(1, 4):%0A    do_mouse(%22Button-%7B0%7D%22.format(i))%0A    do_mouse(%22ButtonRelease-%7B0%7D%22.format(i))%0A    do_mouse(%22Double-Button-%7B0%7D%22.format(i))%0A%0Aroot.mainloop()%0A

Test script for key events