from PIL import ImageChops # $ pip install pillow from pyscreenshot import grab # $ pip install pyscreenshot from datetime import datetime import time,sys,re im = grab(bbox=(160,180,1760,1080)) a=0 while True: # http://effbot.org/zone/pil-comparing-images.htm diff = ImageChops.difference(grab(bbox=(160,180,1760,1080)), im) bbox = diff.getbbox() print(bbox) if bbox is not None: # exact comparison img = grab(bbox=(160,180,1760,1080)) now = datetime.now() date_time = now.strftime("%Y%m%d%H%M%S") te2=r"e:/te/tu/"+date_time+".jpg" img.save(te2) time.sleep(2) a=a+1 print(a) im = grab(bbox=(160,180,1760,1080)) else: time.sleep(2)
标签:截图,1080,python,180,bbox,time,import,grab,屏幕 From: https://www.cnblogs.com/xkdn/p/17417359.html