Alan, 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.
Many thanks, Bill On Thu, Mar 17, 2011 at 04:01, Alan Gauld <alan.ga...@btinternet.com> wrote: > > "Bill Allen" <walle...@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? >> > > curses. > > 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. > > HTH, > > -- > Alan Gauld > Author of the Learn to Program web site > http://www.alan-g.me.uk/ > > > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor >
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor