how to capture key pressing
Tim Roberts
timr at probo.com
Tue Oct 11 02:19:14 EDT 2005
"billie" <mlist at fastwebnet.it> wrote:
>
>> Look at curses.
>
>I was searching for something portable on multiple platforms.
Keyboard access is not portable. It is quite system-specific, even in C.
>Curses doesn't work on Windows.
Sure it does. You can find curses implementations for Windows. However,
it depends on what you are planning to do. If all you want to do is wait
for one character and print it, it's not too hard to have separate schemes
for separate systems:
C:\Data\PyTools>python
Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import msvcrt
>>> msvcrt.getch()
'\x1b'
>>>
(I pressed "escape" after the second "enter".)
--
- Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-list
mailing list