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,437
  • 4
  • 24
  • 38
P_n
  • 940
  • 2
  • 11
  • 25

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,437
  • 4
  • 24
  • 38