Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

detect keypress in python

import keyboard
while True:
    try:
        if keyboard.is_pressed('q'):
            print('You Pressed the Q Key!')
        elif keyboard.is_pressed('a'):
            print('You Pressed the A key!')
            break
    except:
        break
 
PREVIOUS NEXT
Tagged: #detect #keypress #python
ADD COMMENT
Topic
Name
3+1 =