python 中的鼠标侧按钮?
我正在尝试在笔记本电脑上使用鼠标作为遥控器,并且我想使用其中的侧面按钮。我正在用 python 编码,因为我已经成功地使用 autohotkey 完成了它。但是autohotkey使用了太多的资源。 鼠标是Razer Orochi。它有7个按钮和一个滚轮。 我想使用左侧前键作为修饰符,并使用 lbutton、rbutton、mbutton 和滚轮作为辅助键...另外,通过按下两个左侧按钮,我想锁定鼠标,直到 4 个按钮,所有侧面的按钮都被按下。 .. 但我似乎无法弄清楚如何在 python 中读取鼠标侧按钮的输入。
I am trying to use my mouse as remote on my laptop and I would like to use side buttons in them. I am coding in python as I have already succeeded doing it with autohotkey. But autohotkey uses too much resources.
The mouse is Razer Orochi.. It has 7 buttons and a scrollwheel.
I would like to use left side front key for modifier and lbutton, rbutton, mbutton and wheel as secondary... also by pressing both left side buttons I would like to lock the mouse until 4 buttons, all of them on sides are pressed...
Yet I can't seem to figure out how to read input from side buttons on mouse in python.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这并不是一个完整的答案,但也许是一组可以帮助您入门的参考资料。我没有 Windows 上的 Python 经验,但看起来这些可能会有所帮助:
从 Yak 在他的代码中如何用两根手指滚动来判断,我想你正在做的事情并不遥远?我还认为
win32com
会对您有所帮助。This isn't quite an answer, but maybe a set of references to start you out. I don't have experience with Python on Windows, but it looks like these might be helpful:
Judging by how Yak got two-finger scrolling in his code, I imagine what you're doing is not so far off? I also think
win32com
would help you out.最终解决方案是使用 PyHook
非常感谢彼得·帕伦特。
Final solution was made using PyHook
Many thanks to Peter Parente.