pynput
pynput copied to clipboard
simulating mouse drag causes weird behaviors/delay.
At times it wouldn't even register a click on the browser, and the attempt at simulating drag has weird effects, like it doesn't release before it goes into the next drag movement, ending up dragging from X2 to the X1 of the next drag call.
def click(self, New_X: int, New_Y: int):
self.mouse.position = (New_X, New_Y)
time.sleep(5*delay)
self.mouse.click(Button.left)
time.sleep(delay)
def drag(self, X1: int, X2: int, Y: int):
self.mouse.position = (X1, Y)
self.mouse.press(Button.left)
time.sleep(0.5)
self.mouse.position = (X2, Y)
self.mouse.release(Button.left)
time.sleep(0.5)
OS: MacOS M1