Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import keyboard # using module keyboard
- while True: # making a loop
- try: # used try so that if user pressed other than the given key error will not be shown
- if keyboard.is_pressed('q'): # if key 'q' is pressed
- print('You Pressed Q')
- break # finishing the loop
- except:
- break
Advertisement
Add Comment
Please, Sign In to add comment