Popular recipes tagged "getch"http://code.activestate.com/recipes/tags/getch/2011-12-06T08:46:33-08:00ActiveState Code RecipesGet single keypress (Python)
2011-12-06T08:46:33-08:00Steven D'Apranohttp://code.activestate.com/recipes/users/4172944/http://code.activestate.com/recipes/577977-get-single-keypress/
<p style="color: grey">
Python
recipe 577977
by <a href="/recipes/users/4172944/">Steven D'Aprano</a>
(<a href="/recipes/tags/getch/">getch</a>, <a href="/recipes/tags/key/">key</a>).
</p>
<p>Here's a platform-independent module that exposes a single function, getch, which reads stdin for a single character. It uses msvcrt.getch on Windows, and should work on any platform that supports the tty and termios modules (e.g. Linux).</p>
<p>This has been tested on Python 2.4, 2.5 and 2.6 on Linux.</p>