how to capture key pressing

B

billie

Hi all. I'm searching for a module that permit me to costantly log every key
pressed on the keyboard and eventually assign it a function (e.g. when "esc"
is pressed: exit program").
 
B

billie

Look at curses.

I was searching for something portable on multiple platforms.
Curses doesn't work on Windows.
 
T

Tim Roberts

billie said:
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.
(I pressed "escape" after the second "enter".)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top