[Tutor] Linux library for getch() and kbhit()?

Alan Gauld alan.gauld at btinternet.com
Thu Mar 17 10:01:31 CET 2011

"Bill Allen" <wallenpb at gmail.com> wrote

>I have found that for the Windows build of Python the msvcrt library
> provides getch() and kbhit() functions.   Is there a library 
> available for
> the Linux Python build that provides the same or similar functions?


Take a look at the event handling topic in my tutor for examples
comparing msvcrt and curses.

I'm not sure if curses provides a kbhit() equivalent but you can
usually simulate the effect by using a combination of getch()
and ungetch() - not pretty but it works.


Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list