Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python check if hotkey pressed

import keyboard

while True:
    if keyboard.read_key() == "p":
        print("You pressed p")
        break

while True:
    if keyboard.is_pressed("q"):
        print("You pressed q")
        break
        
keyboard.on_press_key("r", lambda _:print("You pressed r"))
Comment

PREVIOUS NEXT
Code Example
Python :: remove word from string python 
Python :: python for get index and value 
Python :: pandas groupby as new column 
Python :: turn pandas entries into strings 
Python :: how to take list of float as input in python 
Python :: train_test_split without shuffle 
Python :: how to plot two columns graphs in python 
Python :: print python path variable 
Python :: pyttsx3 pip 
Python :: sort python dictionary by date 
Python :: plt off axis 
Python :: f string curency format 
Python :: python import text file 
Python :: python reciprocal 
Python :: hello worldpython 
Python :: python year month from date 
Python :: how to find and replace all the punctuation in python strings 
Python :: find index of null values pandas 
Python :: django select database for migrate 
Python :: django queryset average of unique values 
Python :: how to add two different times in python 
Python :: python date 
Python :: Import "decouple" could not be resolved Pylance 
Python :: opening image in python 
Python :: pip install ffmpeg 
Python :: py current date 
Python :: extract numbers from sklearn classification_report 
Python :: check iterable python 
Python :: rotate image pyqt5 
Python :: wait for input python 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =