Feb-20-2023, 01:25 AM
(Feb-20-2023, 12:37 AM)ATARI_LIVE Wrote:(Feb-19-2023, 02:04 PM)Larz60+ Wrote: Please show your code so far (please use bbcode tags)
Difficult to advise otherwise.
import keyboard loopstop=1 while loopstop: keypress = keyboard.read_key() if keypress != 0: print(keypress) if keypress == "esc": loopstop=0This code what i have problem is it will read the key anywhere in OS like I use CMD and it keep reading like key logger which I do not want.
Also another problem is when I pressed, it read and printed then I release key then it ready again. like double printed.
I got it resloved!
import msvcrt while True: if msvcrt.kbhit(): key = msvcrt.getch() print(key.decode(), end='', flush=True)