截取不同名称的屏幕截图的功能

时间:2020-11-03 16:26:11

标签: python screenshot

它总是拍摄图像并将其替换为Picture1,并且一直保持替换状态。

每次打开Page Up时,我希望它创建从Picture1到Picture2的新图片。

import keyboard
import pyautogui
import time

s=0 # this was the mistake thanks L3viathan 
def shoot():
    global s # this also has to be here thanks ggorlen
    myScreenshot = pyautogui.screenshot()
    myScreenshot.save(r'D:\Py\ss\Picture'+str(s)+'.png')
    s=s+1

keyboard.add_hotkey('page up', shoot) 

0 个答案:

没有答案