pip insnall pynput
鼠标控制
mouse = Controller()
创建鼠标控制对象
移动鼠标
mouse.position = (100, 100)
等价于 mouse.move(100, 100)
如果超出屏幕范围则算最大值
mouse.press(Button.left) # 按下左键
mouse.release(Button.left) # 松开左键
mouse.press(Button.right) # 按下右键
mouse.release(Button.right) # 松开右键
mouse.click(Button.right, 2) # 点击两次右键(双击右键)
(待补充完善……)
参考: pynput Package Documentation — pynput 1.7.4 documentation - https://pynput.readthedocs.io/en/latest/ pynput:操作、监控你的鼠标和键盘 - 古明地盆 - 博客园 - https://www.cnblogs.com/traditional/p/11777475.html