On 6/12/11 09:48:39, Steven D'Aprano wrote:
On Tue, 06 Dec 2011 10:19:55 +0430, Sergi Pasoev wrote:

Hi.

I wonder if it is realistic to get a single key press in Python without
ncurses or
any similar library. In single key press I mean something like j and k
in Gnu less
program, you press the key and and it is captured by the script without
need to press enter afterwards


Coincidentally, I was working on that exact function last night, so you
inspired me to put it up on the Python cookbook. This version should work
on any POSIX system such as Linux, as well as Windows. I don't know if it
will work on Macintosh.

http://code.activestate.com/recipes/577977-get-single-keypress/

It works fine on MacOS/X, but probably not on MacOS Classic.

-- HansM



--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to