小智 29
您可以使用PyMouse现已合并PyUserInput.我是通过pip安装的:
apt-get install python-pip
pip install pymouse
在某些情况下,它使用光标,而在其他情况下,它模拟没有光标的鼠标事件.
from pymouse import PyMouse
m = PyMouse()
m.position() #gets mouse current position coordinates
m.move(x,y)
m.click(x,y) #the third argument "1" represents the mouse button
m.press(x,y) #mouse button press
m.release(x,y) #mouse button release
Run Code Online (Sandbox Code Playgroud)
您还可以指定要使用的鼠标按钮.前左键:
m.click(x,y,1)
Run Code Online (Sandbox Code Playgroud)
请记住,在Linux上它需要Xlib.
Epe*_*eli 16
python-uinput非常容易使用.
http://tjjr.fi/software/python-uinput/
这是一个例子https://github.com/tuomasjjrasanen/python-uinput/blob/master/examples/mouse.py
小智 1
打开你的终端并转到cd /usr/share/pyshared/twisted/protocols/mice
也许这个__init__.py mouseman.pypython 脚本对你有用,检查一下。
| 归档时间: |
|
| 查看次数: |
39428 次 |
| 最近记录: |