python 中的鼠标侧按钮?

发布于 2024-12-07 11:46:10 字数 285 浏览 1 评论 0原文

我正在尝试在笔记本电脑上使用鼠标作为遥控器,并且我想使用其中的侧面按钮。我正在用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一百个冬季 2024-12-14 11:46:10

这并不是一个完整的答案,但也许是一组可以帮助您入门的参考资料。我没有 Windows 上的 Python 经验,但看起来这些可能会有所帮助:

  • 有一组 Python 的 Windows 扩展: pywin32
  • Yak通过Python中特殊的方式读取COM创建了一个两指滚动驱动 这里

从 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:

  • there's a set of Windows Extensions for Python: pywin32.
  • Yak created a two-finger scrolling driver by reading the COM in a special way in Python here.

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.

百合的盛世恋 2024-12-14 11:46:10

最终解决方案是使用 PyHook
非常感谢彼得·帕伦特。

Final solution was made using PyHook
Many thanks to Peter Parente.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文