1
我試圖關閉在每次迭代中通過迭代打開的每個圖像。在窗口照片查看器中關閉由枕頭打開的圖像
我在下面提到了這個線程,但正確的答案是不產生結果。
How do I close an image opened in Pillow?
我的代碼
for i in Final_Bioteck[:5]:
with Image.open('{}_screenshot.png'.format(i)) as test_image:
test_image.show()
time.sleep(2)
我也試過,
test_image.close()
,但沒有結果。
我上面的循環打開了5個Windows Photos Viewer對話框;我希望通過迭代,每個窗口都會關閉。
我也看到了這個主題,但答案相當過時,所以不知道是否有更簡單的方法來執行我的願望。 How can I close an image shown to the user with the Python Imaging Library?
謝謝=)