PyQT Listen for SystemWide Key and mouse events

断了今生、忘了曾经 提交于 2019-12-04 20:39:03

I think you'll almost certainly need a third party library for this.

I have no experience of using it, but the Qxt extension library has a QxtGlobalShortcut class, and there are PyQt bindings for it the shape of pygs. Both projects seem to support all the major platforms.

EDIT

Sorry, I didn't read your question properly. You obviously need more than global shortcuts :(

After doing a little more research, it looked like QAbstractEventDispatcher.setEventFilter might have been promising. However, it turns out that Qt only filters events that are sent to the application - never system-wide events. So it definitely looks like a third-party library will be needed to solve this problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!