Using pyhook to respond to key combination (not just single keystrokes)?

前端 未结 4 1391
清歌不尽
清歌不尽 2020-12-13 21:42

I\'ve been looking around but I can\'t find an example of how to use pyhook to respond to key combinations such as Ctrl + C whereas it

4条回答
  •  清歌不尽
    2020-12-13 22:26

    Actually Ctrl+C have it's own Ascii code (which is 3). Something like this works for me:

    import pyHook,pythoncom
    
    def OnKeyboardEvent(event):
        if event.Ascii == 3:
            print "Hello, you've just pressed ctrl+c!"
    

提交回复
热议问题