I am currently writing a program for a fake code/hacker typer which when in python and keys are pressed it prints out source code which makes the user looks like they are typing.
I know using the keyboard
module you can use
import keyboard
keyboard.if_pressed(hotkey)
but how would one use this without specifying any key just if any key is pressed on the keyboard?
import msvcrt
while True:
if msvcrt.kbhit():
key_stroke = msvcrt.getch()
if key_stroke:
print("Clicked")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.