马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
PyUserInput"""
pip install PyUserInput
"""
from pymouse import PyMouse
from pykeyboard import PyKeyboard
import random
class Test:
def __init__(self):
self.mouse = PyMouse() # 实例化鼠标
self.keyboard = PyKeyboard()
def test(self):
x = random.randint(0, 1599)
y = random.randint(0.899)
self.mouse.move(x, y) # 移动鼠标到指定坐标
self.mouse.click(x, y, button=1, n=1) # 在指定坐标处单击(Button is defined as 1 = left, 2 = right, 3 = middle. n点击次数)
self.keyboard.type_string('abcdef', interval=0.5) # 输入abcdef,每个字符输入间隔0.5s
self.keyboard.press_key(self.keyboard.enter_key) # 模拟键盘按enter键
if __name__ == '__main__':
t = Test()
t.test()
具体见以上代码,超级简单好用
唯一的不好就是安装可能会有点麻烦 |