我正在尝试创建一个脚本,以在DirectX游戏中执行一些操作。
我已经完成了移动鼠标的所有工作。
对于Windows(python 3),有没有可用的模块可以移动鼠标?
谢谢!
答案 0 :(得分:0)
我在Python 2.7中曾经使用过pynput。我刚刚在Python 3.7下进行了检查,它可以很好地移动光标。来自链接源的示例代码:
from pynput.mouse import Button, Controller
mouse = Controller()
# Read pointer position
print('The current pointer position is {0}'.format(
mouse.position))
# Set pointer position
mouse.position = (10, 20)
print('Now we have moved it to {0}'.format(
mouse.position))
# Move pointer relative to current position
mouse.move(5, -5)
# Press and release
mouse.press(Button.left)
mouse.release(Button.left)
# Double click; this is different from pressing and releasing
# twice on Mac OSX
mouse.click(Button.left, 2)
# Scroll two steps down
mouse.scroll(0, 2)
编辑:刚刚在DirectX游戏中成功测试。
答案 1 :(得分:-1)
使用名为sikulix的免费软件。它将为您带来奇迹