它总是拍摄图像并将其替换为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)