[Pythonmac-SIG] Non blocking terminal input
Samuel M. Smith
smithsm at samuelsmith.org
Sun Feb 1 13:57:40 EST 2004
Is there an equivalent on mac/unix to the msvcrt module for windows
kbhit() function?
Or in other words is there some way to do non blocking reads of the
terminal as opposed to blocking reads vis a vis raw_input()?
In other can I non blocking poll the terminal input to see if something
is there before I read it.
It looks like I might be able to do it with curses.getch() with
nodelay(True)
Can I treat the terminal stdin as a file and use ftell to see if more
characters have been added since
the last check of ftell?
I am playing around with generator based weightless threads and wanted
to see if I could do interactive I/O with the terminal while running
other tasks.
I know I could do it with threads
Sam,
More information about the Pythonmac-SIG
mailing list