Single key press

Grant Edwards invalid at invalid.invalid
Tue Dec 6 10:22:18 EST 2011


On 2011-12-06, Sergi Pasoev <s.pasoev at gmail.com> wrote:

> I wonder if it is realistic to get a single key press in Python
> without ncurses or
> any similar library.

Yes.  Just put the tty associated with stdin in raw mode and make
single byte read() calls on it. Remember to restore the tty settings
when your program exits.

-- 
Grant Edwards               grant.b.edwards        Yow! World War III?
                                  at               No thanks!
                              gmail.com            



More information about the Python-list mailing list