title: Sense CTRL+X while raw_input>
body: <p>I have a script that looks like (I have imported all required modules.):</p>
  
  <pre><code>def _find_getch():
  try:
      import termios
  except ImportError:
      # Non-POSIX. Return msvcrt's (Windows') getch.
      import msvcrt
      return msvcrt.getch
  
  # POSIX system. Create and return a getch that manipulates the tty.
  import sys, tty
  def _getch():
      fd = sys.stdin.fileno()
      old_settings = termios.tcgetattr(fd)
      try:
          tty.setraw(fd)
          ch = sys.stdin.read(1)
      finally:
          termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
      return ch
  
  return _getch
  
  getch = _find_getch()
  #keypress for CTRL+X is 88
  
  if len(sys.argv) == 1:
      controlPressed = False
      file = ''
      while not controlPressed:
          latest = raw_input("&gt; ")
          key = getch
          if key == '&lt;function _getch at 0x7f9602558e60&gt;':
              controlPressed = True
              sys.exit()
  </code></pre>
  
  <p>I run this script in the terminal and it never senses when I press <kbd>CTRL</kbd>+<kbd>X</kbd>. How would I sense <kbd>CTRL</kbd>+<kbd>X</kbd> while <code>raw_input</code> is running?</p>