Skip to content

Instantly share code, notes, and snippets.

@Quickz
Created October 17, 2020 14:55
Show Gist options
  • Save Quickz/9bd3ee7f3ca3b5732382ff15abfc9a5e to your computer and use it in GitHub Desktop.
Save Quickz/9bd3ee7f3ca3b5732382ff15abfc9a5e to your computer and use it in GitHub Desktop.
Script that makes a screen shot every 5 seconds using a Windows feature
# "pip install pynput" to install pynput
from pynput.keyboard import Key, Controller
from time import time, sleep
def take_screenshot():
keyboard = Controller()
# Windows key + Print screen
with keyboard.pressed(Key.cmd_r):
keyboard.press(Key.print_screen)
keyboard.release(Key.print_screen)
interval = 5;
while True:
sleep(interval - time() % interval)
take_screenshot()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment