title: How to take Screenshot in Mac OS X from inside of Python: aka Command-Control-Shift-4
body: <p>With Command-Control-Shift-4 the screenshot area can be taken/then saved to a clipboard.
  I wonder if same would be possible from inside of Python. Ideally an image file format could be specified as well as to where to save it all programmatically within Python. Any ideas?</p>
  
  <h3><em>edited later 1</em></h3>
  
  <p>I've located <code>applescript</code> that does almost what's needed except this script captures an entire screen. I would like to limit it to a region instead. </p>
  
  <pre><code>tell application "System Events"
      keystroke (ASCII character 36) using {command down}
      delay 1
      keystroke space
  end tell
  </code></pre>
  
  <h3><em>edited later 2</em></h3>
  
  <p>The apple script below does a region screen capture quite well (there is still no control on to where exactly the captured image is saved (it is saved by default to the user's Desktop). </p>
  
  <pre><code>tell application "System Events"
      keystroke (ASCII character 36) using {command down}
      key code 4 using {command down, shift down}
  end tell
  </code></pre>
  
  <p>The question is how to customize the output file path location...</p>