Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pyHook
- from pyHook.HookManager import HookConstants
- import pygame
- ctrl_pressed = False
- alt_pressed = False
- a_pressed = False
- def OnKeyboardEventDown(event):
- global ctrl_pressed
- global alt_pressed
- global a_pressed
- if(event.KeyID == HookConstants.VKeyToID('VK_LCONTROL')):
- ctrl_pressed = True
- if(event.KeyID == HookConstants.VKeyToID('VK_LMENU')): # left alt
- alt_pressed = True
- if(event.KeyID == 65): # 'a'
- a_pressed = True
- if(ctrl_pressed and alt_pressed and a_pressed):
- print("YEAHHHH BUDDY!!!")
- return True
- def OnKeyboardEventUp(event):
- global ctrl_pressed
- global alt_pressed
- global a_pressed
- if(event.KeyID == HookConstants.VKeyToID('VK_LCONTROL')):
- ctrl_pressed = False
- if(event.KeyID == HookConstants.VKeyToID('VK_LMENU')): # left alt
- alt_pressed = False
- if(event.KeyID == 65): # 'a'
- a_pressed = False
- return True
- hm = pyHook.HookManager()
- hm.KeyDown = OnKeyboardEventDown
- hm.KeyUp = OnKeyboardEventUp
- hm.HookKeyboard()
- # initialize pygame and start the game loop
- pygame.init()
- while True:
- pygame.event.pump()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement