I'm trying to build create a script that does a few action inside an DirectX game.

I've got everything working exept for moving the mouse.

Is there any module avalable that can move the mouse, for windows (python 3)

Thanks!

解决方案

I used pynput once in Python 2.7. I just checked under Python 3.7 and it moves the cursor alright. Sample code from linked source:

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)

Edit: Just successfully tested in a DirectX game.

python模拟按键directx,Python3在DirectX游戏中移动鼠标相关推荐

  1. python模拟按键_python 模拟按键放在模拟器Python初学者的17个技巧

    Python初学者的17个技巧,有需要的朋友可以参考下. W WW.002pc .COM认为此文章对<python 模拟按键放在模拟器Python初学者的17个技巧>说的很在理. 交换变量 ...

  2. Unity3D游戏中隐藏鼠标光标

    在游戏中隐藏鼠标光标,之前的方法Screeen.showCursor=false;已经被弃用了,目前的方法是Cursor.visible = false;

  3. python模拟按键_Python实现windows下模拟按键和鼠标点击的方法

    本文实例讲述了Python实现windows下模拟按键和鼠标点击的方法.分享给大家供大家参考.具体如下: 这段代码可以模拟在窗口上按下按键.鼠标左键点击.鼠标右键点击.鼠标双击等等. 前提先要安装 p ...

  4. python模拟按键与鼠标操作(二)将复制内容粘贴至指定文本框中

    一.简介 我们在使用python模拟键盘鼠标时,经常需要传入一些变量在页面的文本框中,比如传入查询数据的日期,查询数据的选项等等,这时我们可以利用datatime生成时间,定义为一个变量,然后利用以下 ...

  5. 游戏中实现鼠标拖尾效果

    游戏中使用Trail Renderer这个通过设置参数来实现拖尾效果,通过在update中吧鼠标的点击的路径给怪哉这个得物体. 转载于:https://www.cnblogs.com/qinshuai ...

  6. python模拟按键包_今天玩点啥:利用python之PyUserInput实现模拟鼠标键盘操作,抢红包?聊天?自动下载?...

    一.PyUserInput安装 python3.5的PyMouse和PyKeyboard模块都集成到了PyUserInput模块中.在python3.5中,直接安装PyUserInput模块即可 Py ...

  7. python模拟按键与鼠标操作(一)

    简介 有时候我们需要使用python执行一些脚本,可能需要让程序自动按键或自动点击鼠标,来模拟人操作键盘.鼠标,这里推荐使用pywin32库,安装方式如下: 输入:pip install pywin3 ...

  8. RF自动化--python模拟按键精灵

    #Python下在windows系统下仿照按键精灵 功能:找到对应软件程序,并对界面进行操作,主要进行点击.信息输入.输出信息得检测 ##所用到得库 库名 作用 win32gui gui调用 win3 ...

  9. python模拟按键,键盘码

    Python扩展模块--调用WindowsAPI(pywin32的简单使用) 这块使用的比较少,只用到了模拟键盘按键, 调用鼠标比较费事,是通过像素坐标实现的,如果没有特殊需求或万不得已不建议使用 1 ...

  10. python模拟按键网游_Python实现windows下模拟按键和鼠标点击的方法

    转于博客 https://www.cnblogs.com/huidaoli/p/7398392.html,原作者:huidaoli # _*_ coding:UTF-8 _*_ import win3 ...

最新文章

  1. 语言的神经结构: 一体化建模集中于预测处理(附ppt)
  2. Linux学习 Unit 12
  3. 勤哲cad服务器支持ug,勤哲CAD服务器
  4. java定时线程池_java 定时器线程池(ScheduledThreadPoolExecutor)的实现
  5. 在 .NET 中使用 Flurl 高效处理Http请求
  6. Android 最简单的MVP案例;
  7. 5-Springboot实现web的常用功能
  8. 线性代数-求解地球法线
  9. JSON入门指南--服务端处理JSON
  10. 四年级计算机上册课程标准,新课程标准人教版四年级上册数学全册教案设计
  11. 影视后期调色必要性以及操作理论
  12. PKU四日游(信息科学夏令营)
  13. 第五期送书来了,这次送的都是畅销书!
  14. 格式工厂 wav 比特率_TunesKit Audio Converter for Mac(音频格式转换软件)
  15. linux 使用dmidecode查看设备序列号
  16. 别再说自己不会了!2021年教你增加拿到BAT等大厂offer几率,醍醐灌顶!
  17. Metaq原理与应用
  18. mysql修改密码报错:Your password does not satisfy the current policy requirements
  19. MVC4中ajax分页技术实例
  20. 新电脑win10 改win7 要注意

热门文章

  1. 目录-GB/T 151-2014 热交换器
  2. bios开启虚拟化技术
  3. 罗技G304等鼠标GHUB驱动配置
  4. html5人脸登录,基于HTML5 的人脸识别活体认证
  5. 哪些思维方式是你刻意训练过的?
  6. vue 导出excel表格-乱码问题
  7. 对外汉语语料库有哪些_燃,9大对外汉语必备语料库,每个都很有“性格”!!...
  8. 有关arcmap的学习使用心得
  9. 泛娱乐出海走出水土不服,元宇宙社交诞生新机会!
  10. MATLAB调用C语言程序—一个简单的例子