版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
这个程序比较简单,记录如下:
import time
from PIL import ImageGrab
# 截屏
def Screenshot():
nowtime = time.strftime('%Y_%m_%d_%H_%M_%S', time.localtime(time.time()))
print(nowtime)
# 截屏语句很简单的
im = ImageGrab.grab()
# 保存指定路径
im.save('C:/Users/Jack/Desktop/test/%s.png' %(nowtime))
while True:
print("截图!")
Screenshot()
print("暂停")
print("\n")
time.sleep(10) # 定时10s截取一次