0

Is there a way tell python script to take a screenshot automatically and save it to desktop? All I am finding is great stuff on here, but it all seems to prompt to grab a selection after executing the script. I have found at least 5 pages on stackoverflow and none were automatic. Thanks

alexisdevarennes
  • 5,165
  • 3
  • 23
  • 37
Petr
  • 201
  • 1
  • 3
  • 13

1 Answers1

0

This should do the trick on a mac (unix).

import os
os.system("screencapture screenshot.jpg")

You can read more here:

http://osxdaily.com/2011/08/11/take-screen-shots-terminal-mac-os-x/

And for linux this would do the trick:

import os
os.system("gnome-screenshot --file=screenshot.png")

For further gnome-screenshot commands type: gnome-screenshot --help

alexisdevarennes
  • 5,165
  • 3
  • 23
  • 37