title: Is there a cross-platform python low-level API to capture or generate keyboard events?
body: <p>I am trying to write a cross-platform python program that would run in the background, monitor all keyboard events and when it sees some specific shortcuts, it generates one or more keyboard events of its own.  For example, this could be handy to have Ctrl-@ mapped to "my.email@address", so that every time some program asks me for my email address I just need to type Ctrl-@.</p>
  
  <p>I know such programs already exist, and I am reinventing the wheel... but my goal is just to learn more about low-level keyboard APIs.  Moreover, the answer to this question might be useful to other programmers, for example if they want to startup an SSH connection which requires a password, without using pexpect.</p>
  
  <p>Thanks for your help.</p>
  
  <p>Note: there is <a href="https://stackoverflow.com/questions/310576/low-level-keyboard-input-on-windows">a similar question</a> but it is limited to the Windows platform, and does not require python.  I am looking for a cross-platform python api.  There are also other questions related to keyboard events, but apparently they are not interested in system-wide keyboard events, just application-specific keyboard shortcuts.</p>
  
  <p>Edit: I should probably add a disclaimer here: I do <em>not</em> want to write a keylogger.  If I needed a keylogger, I could download one off the web a anyway. ;-)</p>