Pymouse使用小结

2022-10-27 12:27:30

Pymouse使用小结

1. Pymouse的本身是利用ctypes调用一些win32中的api,功能较为单一,以下为从官方文档中提取的要素

#import the module
from pymouse import PyMouse# instantiate an mouse object
m=PyMouse()# move the mouse to int x and int y (these are absolute positions)
m.move(200,200)# click works about the same, except for int button possible values are 1: left, 2: right, 3: middle
m.click(500,300,1)# get the screen size
m.screen_size()
#(1024,768)# get the mouse position
m.position()
#(500,300)

但是在使用m.click时候发现这是一个双击事件,两次双击分别被放在了press和release中

结果发现是给的windows.py库文件中出错了
改成https://github.com/pepijndevos/PyMouse/blob/master/pymouse/windows.py
这个版本就没有问题了…

求求大佬下次别传错误的库文件啊!我再也不用pip install直接安装了.jpg

2.Pyhook的安装

推荐一个网站
https://www.lfd.uci.edu/~gohlke/pythonlibs/
提供了大量的python拓展库的非官方版本
从其中可以下载到一个whl文件

使用方法为到whl文件的目录下打开cmd,用Pip install安装即可

  • 作者:ZhzetFor
  • 原文链接:https://blog.csdn.net/qq_32631151/article/details/83037831
    更新时间:2022-10-27 12:27:30