I have tried a module called readchar to make a Python 2.7 script detect keystrokes in Windows 7.
I found it via a link from Stack Overflow.
When <ctrl>z  is pressed its output is printed in the console as
u'\x1a'
According to Python 2.7 its type is 'str'. Seeing that it is preceded by a 'u', why is it not 'unicode'? While it appears in the console as above, if it is assigned to a variable ( c = repr(readchar.readkey()) )
and then the value of the variable is tested:
print c == u'\x1a'
the answer is 'False'
This does not make sense. What type of object is a keystroke?

Perhaps I need to find some other way for a Python script detect keystrokes but I am confused as to what Python sees them as.

Any advice would be welcome.

Regards

John Sampson

_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to