I am very new to python and programming in general. I am trying to make a program that will print something if a key is pressed.
I want it to work anytime while the program is running (using input
or raw_input
will not work). In my IDE (Visual Studio 2019) the word keyboard
is underlined in green and when I hover over it a box says Unresolved import 'keyboard'
.
How can this be fixed?
import keyboard
a = True
while a:
if keyboard.is_pressed('1'):
print("Hello World")