无需手动操作,代码截图

解决场景:
自动截取屏幕相应图片,无需手动鼠标移动截图。并进行保存。

from PIL import ImageGrab

#  get capture
def capture():
  # the first two parameters are the starting capturing positon, the rest parameters are the pic size(width and length)
    bbox = (30, 30, 500, 100)
    im = ImageGrab.grab(bbox)
  # saving path
    im.save(path)  
    im.show()