getting keyboard input 1 char at a time
Seung Chan Lim
limsc at maya.com
Tue Oct 31 10:16:40 EST 2000
> Not your lucky day: Python doesn't offer a portable way to do this
because
> C doesn't (nothing in the std C language or libraries addresses this). It
> is indeed a x-platform nightmare. The std getpass.py module is a good one
> to study.
>
> msvcrt.getch() and getche() work well in Windows, provided you're running
in
> a DOS box (not, e.g., in IDLE), and don't try also to read from sys.stdin
> (MS doesn't support mixing console I/O with C stdio -- the results are
> unpredictable if you try).
yeah, that's rather unfortunate... I have a module that I wrote for windows
that was mainly to help my python game engine, that'll work for non-DOX box
situation, but that's also not cross platfom.
this may be overkill, but you might want to take a look at the libraries
that pySDL provides since SDL is cross-platform and I know they read
keyboard input cross platform.
slim
More information about the Python-list
mailing list