I'm writing a macro generator/ keyboard remapper in python, for xubuntu.
I've figured out how to intercept and record keystrokes, and send keystrokes I want to record, but I haven't figured out how to block keystrokes. I need to disable keyboard input to remap a key. For example, if I wanted to send 'a' when I press the 's' key, I can currently record the 'a' keystroke, and set it to playback when I press the 's' key. I cannot, however keep the 's' keystroke from being sent alongside it.
I used the pyxhook module from an open source keyboard-logger for the hooks, and a again, the xtest fake input method from the python x library.
I remember reading somewhere about somebody blocking all keyboard input by redirecting all keystrokes to an invisible window by using tkinter. If somebody could post that method that'd be great. 
I need something that will block all keystrokes, but not turn off my keyboard hooks.
I've got a keyboard hook that detects X events. I'm looking for a way to globally prevent a single keyboard event from being sent to a window. Something that works by accessing the event queue and removing the keyboard event from it would be ideal. It looks like it should be possible using Python Xlib, but I can't figure it out.
Python disable/redirect keyboard input