Skip to content
Snippets Groups Projects
Commit c63c204e authored by TH's avatar TH
Browse files

Take pictures of the screen for timelapse.

parent ce5f2fdd
Branches
No related tags found
No related merge requests found
import subprocess as sp
import os
import os.path
import time
import mss
trial = 1
count = 0
def get_next_dname():
return f'record_{trial}'
def get_next_fname():
return f'{out_dname}/record_' + ('%08d.png'%count)
out_dname = get_next_dname()
while os.path.exists(out_dname):
trial += 1
out_dname = get_next_dname()
os.mkdir(out_dname)
with mss.mss() as sct:
while True:
out_fname = get_next_fname()
# No stupid flash thanks:
# sp.call(['gnome-screenshot', '-f', out_fname])
filename = sct.shot(output=out_fname)
print(filename)
count += 1
time.sleep(0.5)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment