Re: Keyboard detecting in Python
Thank you kindly. I found that really useful actually, not only for that but for a few other projects I'm doing, that library is neat. If anyone else ever runs into this issue, here's my working code.
import msvcrt
while True:
if msvcrt.kbhit():
a = msvcrt.getch()
if a == b'y':
#do stuff
elif a == b'n':
#do other stuff
else:
#complain to the user
I messed this up for a while thinking 'y' or 'n' would be enough, but then I printed msvcrt.getch and found that you have to include b and then the key in quotes. To anybody in the future that might need it, I hoped that helped, and thanks again to @2
-- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector