Re: [python-win32] Get key press in Windows 7

2014-11-27 Thread Tim Roberts
On Nov 27, 2014, at 10:06 AM, John Sampson wrote: > > 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 z is pressed its output is printed in the console as > u'\x1a’ Right, because that’s the

[python-win32] Get key press in Windows 7

2014-11-27 Thread John Sampson
Many thanks - by excluding repr the code behaves in a comprehensible way. The example code that was provided at Stack Overflow included repr so I assumed that it was necessary for some reason. If I were allowed to comment there I would ask why. Regards John Sampson On 27/11/2014 18:26, Randy

Re: [python-win32] Get key press in Windows 7

2014-11-27 Thread Randy Syring
I believe your problem is the use of repr() when assigning to c: >>> u'\x1a' u'\x1a' >>> c = u'\x1a' >>> c == u'\x1a' True >>> repr(c) "u'\\x1a'" >>> repr(c) == u'\x1a' False >>> *Randy Syring* Husband | Father | Redeemed Sinner /"For what does it profit a man to gain the whole world and forfe

[python-win32] Get key press in Windows 7

2014-11-27 Thread John Sampson
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 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 i