There is a script that makes a screenshot every 10 seconds.
from PIL import Image, ImageGrab from datetime import datetime, date, time import sched, time import os if not os.path.exists('./screen'): os.makedirs('./screen') s = sched.scheduler(time.time, time.sleep) def do_something(sc): dt = datetime.strftime(datetime.now(), "%Y%m%d%H%M%S") img = ImageGrab.grab() img.save('./screen/' + dt +".png", "PNG") s.enter(10, 1, do_something, (sc,)) s.enter(10, 1, do_something, (s,)) s.run() Is it possible to make a condition that a print("END") displayed on the screen before the completion of a forced script?
By force, I mean some kind of cycle, which, for example, at 18:00 will shut down the script itself and display print("END")
try/except KeyboardInterruptaround run (). You can still atexit module (only for normal output or test which signals it understands). - jfsprint("END")- OuFinxs.enterabs()call? How is 18:00 in time. Time value turn? How to exit the script in callback (doessys.exit()). - jfs