截屏函数

    科技2022-07-10  113

    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()

    Processed: 0.072, SQL: 8