Skip to content

Instantly share code, notes, and snippets.

@kairat-beep
Created June 2, 2018 21:35
Show Gist options
  • Save kairat-beep/11534729398d09fbfb0aaccb4723c260 to your computer and use it in GitHub Desktop.
Save kairat-beep/11534729398d09fbfb0aaccb4723c260 to your computer and use it in GitHub Desktop.
screen shot saving script that takes every 1 sec. Used to capture changing frames.
import winsound
from time import sleep
import pyscreenshot as ImageGrab
if __name__ == '__main__':
i = 0
try:
while True:
Freq = 100 # Set Frequency To 2500 Hertz
Dur = 50 # Set Duration To 1000 ms == 1 second
winsound.Beep(Freq,Dur)
# grab fullscreen
im = ImageGrab.grab()
# save image file
im.save('screenshot {}.png'.format(i))
i+=1
# show image in a window
#im.show()
sleep(1)
except KeyboardInterrupt:
print("You stopped loop")
#-#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment