Recording keystrokes with pyHook
<p>I've been trying to get this to work for some time now (to get the keyid to print in text, A="A", not A=125.)</p>

<p>Here is my code, it either prints "None" and sometimes it prints the wrong type, or even just the keyid again. (With different IDToName arguments)</p>

<pre><code>import pyHook
from pyHook import HookManager
from pyHook.HookManager import HookConstants
import time
import pythoncom



def OnKeyboardEvent(event):
    print HookConstants.IDToName(event.Ascii)

hm = pyHook.HookManager()
hm.KeyDown = OnKeyboardEvent
hm.HookKeyboard()

while True:
    pythoncom.PumpMessages()
</code></pre>
