#!/usr/bin/env python # # just clicking # from pynput.mouse import Button, Controller import time mouse = Controller() countdown = 5 delay = 0.25 loops = 10000 i = 0 while i < countdown: print("{}...".format(countdown - i)) time.sleep(1) i = i + 1 i = 0 while i < loops: mouse.click(Button.left, 1) time.sleep(delay) i = i + 1
def __init__(self, msg_worker): threading.Thread.__init__(self) self.stopFlag = True self.msgWorker = msg_worker self.mouse = Controller()
def click(pos, count): # 鼠标左键单击 mouse = Controller() mouse.position = pos mouse.click(Button.left, count)
def __init__(self, path): self.path = path self.mouse_controller = Controller() self.capturing = False self.start = []
from pynput import mouse from pynput.mouse import Controller import Quartz # HOW TO USE: # 1. Set desired scrolling sensitivity # 2. Run script, e.g. python mac-scroll-fix.py # Recommended to add this script to your startup items # desired scrolling sensitivity sensitivityX = -15 sensitivityY = 10 mouseController = Controller() # Intercept event and modify it if it's mouse scroll def darwin_intercept(event_type, event): # detect if it was mouse scroll event (type 22) if event_type == 22: # all possible event properties: https://developer.apple.com/documentation/coregraphics/cgeventfield # 11/12 - kCGScrollWheelEventDeltaAxis1/2 # Change in vertical position # scroll up values are 0 and higher # scroll down values are -1 and lower originalDistanceX = Quartz.CGEventGetIntegerValueField(event, 12) originalDistanceY = Quartz.CGEventGetIntegerValueField(event, 11) # 96/97 - kCGScrollWheelEventPointDeltaAxis1/2 # Pixel-based scrolling distance