【发布时间】:2018-08-10 19:37:42
【问题描述】:
我正在尝试构建一个在 DirectX 游戏中执行一些操作的脚本。
除了移动鼠标之外,我已经完成了所有工作。
是否有任何可以移动鼠标的模块,适用于 windows (python 3)
谢谢!
【问题讨论】:
标签: python windows python-3.x directx
我正在尝试构建一个在 DirectX 游戏中执行一些操作的脚本。
除了移动鼠标之外,我已经完成了所有工作。
是否有任何可以移动鼠标的模块,适用于 windows (python 3)
谢谢!
【问题讨论】:
标签: python windows python-3.x directx
我在 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 游戏中成功测试。
【讨论】:
使用名为 sikulix 的免费软件应用程序。它会为你创造奇迹
【讨论】: