博主头像
CFX | Work

一个业余的分享网站

python - 双击点赞小工具

这里用的第三方库是pyautogui

import time
import pyautogui
pyautogui.FAILSAFE =False
pyautogui.PAUSE = 0.1
# print(pyautogui.size())   # 返回所用显示器的分辨率
width,height = pyautogui.size()
# print(width,height)
time.sleep(3)
pyautogui.moveTo(width/8, height-height/6, duration=1)

# print(x, y)

i = 1
while i < 1000:
    x, y = pyautogui.position()
    posx, posy = int(width/8), int(height-height/6)
    if x == posx and y == posy:
        print("开始双击!")
        pyautogui.doubleClick(width/8,height-height/6) # 指定位置,双击左键
    else:
        print("鼠标移动,停止双击!")
        break
    time.sleep(0.02)
    i += 1
else:
    print("-"*30)
    print("任务结束!")
    print("-"*30)
python - 双击点赞小工具
https://cfx.work/index.php/archives/10/
本文作者 silence
发布时间 2024-11-28
许可协议 CC BY-NC-SA 4.0
发表新评论