mouse click with ctypes.windll and win32api

import win32api
from ctypes import windll


def click(x, y, button=1, n=1):
    for i in range(n):
        flag_press = 2 ** ((2 * button) - 1)
        flag_release = 2 ** (2 * button)
        windll.user32.SetCursorPos(x, y)
        win32api.mouse_event(flag_press, x, y)
        win32api.mouse_event(flag_release, x, y)

click(1558,1066, 2)
原文地址:https://www.cnblogs.com/otfsenter/p/7484352.html