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)
posted @ 2017-09-06 13:32  idlewith  阅读(317)  评论(0编辑  收藏  举报