kcsaff / getkey

MIT License
41 stars 18 forks source link

Waits for enter key to be pressed #15

Open SuperSonyk opened 4 years ago

SuperSonyk commented 4 years ago

I have a script automatically detecting the pressed key and printing it but nothing gets printed until the enter key gets pressed

from getkey import getkey, keys

while True: key = getkey() print(key, end='')

edit: The problem only occurs when the print function has the end= part

xfoscarz commented 4 years ago

You need to flush the stream. Try this: print(key, end='',flush=True)