Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

PREVIOUS NEXT
Code Example
Python :: python list iterate in 1 line 
Python :: remove outliers python dataframe 
Python :: make dataframe index a column 
Python :: how to count special values in data in python 
Python :: import image 
Python :: python set negative infinity 
Python :: minimum of two columns in pandas 
Python :: no such table django 
Python :: python how to use input 
Python :: how to use ggplot matplotlib 
Python :: Substring in a django template? 
Python :: prevent list index out of range python 
Python :: natural log and log base 10 in python 
Python :: spacy ner 
Python :: python 3.9 features 
Python :: distinct rows in this DataFrame 
Python :: sum of column in 2d array python 
Python :: how to do element wise multiplication in numpy 
Python :: wolfram alpha python module 
Python :: find columns with missing values pandas 
Python :: reverse text python 
Python :: get string until character python 
Python :: python xml parser 
Python :: add to middle of list python 
Python :: sort dict by value 
Python :: how to check if given number is binary in pytho 
Python :: pandas merge on columns different names 
Python :: python beginner practice problems 
Python :: pandas shift all columns 
Python :: Python Creating string from a timestamp 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =