Click the left mouse button to identify python

 

#coding=utf-8
import pyHook
import pythoncom

# To listen to mouse events call
onMouseEvent DEF ( Event ):
     IF ( Event .MessageName =! " Mouse the Move " ): # because the mouse a move will have a lot mouse move, so at this filter
        Print ( Event .MessageName)
     return True # normal call to True only if is False, then the event is intercepted

def main():
    # Create Manager
    HM = PyHook.HookManager ()
    # Monitor mouse 
    hm.MouseAll = onMouseEvent   
    hm.HookMouse ()
    # Cycle monitor
    pythoncom.PumpMessages() 
 
if __name__ == "__main__":
    main()

effect

 

Guess you like

Origin www.cnblogs.com/sea-stream/p/10989772.html