質問

I'm building a qt app in python. One of the things that I need to do is wait in the background for a key combo like ctrl+b of something like that and then doing something with the currently active window.

Is there a simple library that can do this?

役に立ちましたか?

解決

Set global hotkey with Python 2.6

http://bytes.com/topic/python/answers/574341-how-create-global-hotkey

Python Global Hotkey

Looks like pyhook or wxPython for windows, and XLib for linux, or maybe keybinder for Gnome.

And if you were only listening for it while your program was active, Qt has something for it:

Respond to application-wide "hotkey" in Qt

Hope that helps.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top