Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用tkinter保存多个屏幕截图_Python_Tkinter - Fatal编程技术网

Python 使用tkinter保存多个屏幕截图

Python 使用tkinter保存多个屏幕截图,python,tkinter,Python,Tkinter,我想使用python中的tkinter一次保存多个屏幕截图,但无法将图像文件附加到文件夹中。请告诉我怎么做 def takeScreenshot (): x = 1 while x < 4: img = pyautogui.screenshot() img.save("‪C:\Shivanshi\image\screenshot"+str(x)+".png") x += 1

我想使用python中的tkinter一次保存多个屏幕截图,但无法将图像文件附加到文件夹中。请告诉我怎么做

def takeScreenshot ():
    x = 1
    while x < 4:
        img = pyautogui.screenshot()
        img.save("‪C:\Shivanshi\image\screenshot"+str(x)+".png")
        x += 1
        time.sleep(2)
def截图():
x=1
当x<4时:
img=pyautogui.screenshot()
img.save(“‪C:\Shivanshi\image\screenshot“+str(x)+”.png”)
x+=1
时间。睡眠(2)

如果问题与位置有关。 将路径更改为

r"‪C:\Shivanshi\image\screenshot"+str(x)+".png"


这是否回答了您的问题?请尝试
img.save(r“C:\Shivanshi\image\screenshot”+str(x)+.png”)
"‪C:/Shivanshi/image/screenshot"+str(x)+".png"