from PIL import ImageGrab import time import tkinter as tk
window = tk.Tk() screenWidth = int(window.winfo_screenwidth()) screenHeight = int(window.winfo_screenheight())
def screenshot(): filename = str(time.time()) + “.jpg” ImageGrab.grab((0, 0, screenWidth, screenHeight)).save(filename, quality=95, subsampling=0)
if name == ‘main’: screenshot()