Why the fuck does the following code hangs on a mouse press?
import cv2 as cv
import pydirectinput
import time
import win32api, win32con
i = 0
def click(x,y):
win32api.SetCursorPos((x, y))
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0)
time.sleep(.1)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0)
while i != 20:
click(0,0)
print("Click")
time.sleep(.1)
pydirectinput.press('space')
print("Space key pressed!")
i += 1
It just refuses to work, pyautogui, win32api, pydirectinput, NOTHING works.
it works perfectly fine with keyboard inputs, the moment you add a mouse input it immediately hangs, it just stops fucking working and i don't understand why.