Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
A fairly new library for working with TUI (text user interface)
https://github.com/willmcgugan/textual
pip3 install keyboard
First, install the Keystroke Handling
library :
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 A Key!')
break # finishing the loop
except:
break # if user pressed a key other than the given key the loop will break
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question