The solution was right there as a comment in your code: you need to add "return True" if you want to pass the keypress along. Conversely, "return False" will block it.
Something like: def OnKeyboardEvent(event): print event.ScanCode, event.Key return True On Mon, Mar 19, 2012 at 6:32 PM, Ryan Strunk <ryan.str...@gmail.com> wrote: > Hi everyone, > I wrote a little while back about how I wanted to tie the arrow keys > specifically to my program so that they could be used exclusively for the > program instead of being intercepted by a screen reader. I attempted to > modify the code from the tutorial I found, but it is producing some rather > strange results. In addition to not allowing the arrow keys to work inside > of the program, the program also blocks the arrow keys in other windows. > Can > anyone tell me, please, what is going wrong and how I can fix it? > Here is the code I have pasted at the bottom of my main file: > def OnKeyboardEvent(event): > # return True to pass the event to other handlers > return (event.Key not in ['Up', 'Down', 'Right', 'Left']) > > # create a hook manager > hm = pyHook.HookManager() > hm.KeyDown = OnKeyboardEvent > hm.HookKeyboard() > pythoncom.PumpMessages() > > Thanks for your help. > Best, > Ryan > >