import Tkinter
from Tkinter import *
root = Tk()
prompt='Click any button'
L = Label(root, text=prompt, width=len(prompt))
L.pack()
def do_mouse(eventname):
def mouse_binding(event):
msg = 'Mouse event %s' % eventname
L.config(text=msg)
L.bind_all('<%s>'%eventname, mouse_binding)
for i in range(1,4):
do_mouse('Button-%s'%i)
do_mouse('ButtonRelease-%s'%i)
do_mouse('Double-Button-%s'%i)
root.mainloop()
|