其他分享
首页 > 其他分享> > 实现鼠标一直运动

实现鼠标一直运动

作者:互联网

  1. 安装好Python和pip,并保证二者能够正常使用;

  2. 使用下方命令安装指定版本的 pyautogui库:


pip install pyautogui==0.9.50

  1. 撰写下方代码:
import pyautogui
import random
import time


while True:
    x = random.randint(-200, 200)
    y = random.randint(-200, 200)
    pyautogui.moveRel(x, y)
    time.sleep(5)

  1. 运行写入上方代码的脚本,即可看到效果。



作者:艾孜尔江

标签:pyautogui,200,鼠标,randint,实现,random,pip,import,运动
来源: https://www.cnblogs.com/ezhar/p/15915231.html