[Tutor] Linux library for getch() and kbhit()?
wallenpb at gmail.com
Thu Mar 17 16:46:31 CET 2011
Ah ha, ungetch(), that is what I was needing. I had be trying to simulate
kbhit() with getch() and keep being left with unhandled data in the buffer.
I had resorted to a trash=raw_input() to clear it.
On Thu, Mar 17, 2011 at 04:01, Alan Gauld <alan.gauld at btinternet.com> wrote:
> "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
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor