Detecting key presses

Diez B. Roggisch deets at nospam.web.de
Sun Jun 18 10:11:37 EDT 2006


tylertacky at gmail.com schrieb:
> Ok, I'm pretty new to python, so this might be a stupid question. I'm
> trying to write a simple text-based pong clone, and I can't figure out
> how to read key presses to move the paddles. I just need something that
> does the same thing as getch() and kbhit(). I can't use those because
> their windows only, and I'm running Linux.
> 
> Someone suggested using curses, but that does crazy things with my
> output, and leaves the terminal unusable after the program closes.

Maybe using pygame for a graphical version is appealing to you - 
additionally, the event-sytem of it will do what you ask for.

Diez



More information about the Python-list mailing list