Polling from keyboard

Diez B. Roggisch deets at nospam.web.de
Tue May 2 14:17:20 EDT 2006


sturnfie at gmail.com wrote:

> I am trying to find a way to poll the keyboard.  In my searching, I
> have found that Windows users are given the msvcrt module.  Is there an
> equivilant for Unix systems?
> 
> I am writing a p2p chat application, and would like to ideally approach
> user input in a manner similar to the way I am using poll() to moniter
> the sockets for events

I currently do that under Linux using /dev/input/*. However, that's for a
special case where we want several keyboards read simultaneously.

I guess what you want is a RAW-mode for your terminal, or alternatively the
event-system of your windowing system. Then you can get every keystroke.
But we need somewhat more information to be more helpful I fear.

diez



More information about the Python-list mailing list