Mouse action : Mouse Action : Event PYTHON examples


PYTHON examples » Event » Mouse Action »

 

Mouse action


Mouse action: single click, double click


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()

           
       



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo Event
» Mouse Action