title: Press esc to stop and any other key to continue in Python
body: <p>Now with help of <code>raw_input</code>, I can call a method every time user presses <code>Enter</code>.</p>
  
  <pre><code>if __name__ == '__main__':
      while True:
          raw_input("Press Enter to continue...")
          _start()
  def _start():
       print("HelloWorld")
  </code></pre>
  
  <p>There is a problem because only <code>Ctrl + C</code>, the program can be stopped. As you see, I make my program to wait user to press key.</p>
  
  <p>From <code>opencv</code>, I find there is a similar need.</p>
  
  <pre><code># Hit 'q' on the keyboard to quit!
  if cv2.waitKey(1) &amp; 0xFF == ord('q'):
      break
  </code></pre>
  
  <p>Simply I want to press esc key to exit program and press any other key to continue. So there is any way to do like this?</p>
  
  <h1>In Addition</h1>
  
  <p>My os is OSX.</p>