I'm trying to close each image opened via iteration, within each iteration.
I've referred to this thread below, but the correct answer is not producing the results.
How do I close an image opened in Pillow?
My code
for i in Final_Bioteck[:5]:
with Image.open('{}_screenshot.png'.format(i)) as test_image:
test_image.show()
time.sleep(2)
I also tried,
test_image.close()
, but no result.
My loop above is opening 5 Windows Photos Viewer dialogs; I was hoping that through iteration, each window would be closed.
I saw this thread as well, but the answers are pretty outdated, so not sure if there is a more simple way to execute what I desire. How can I close an image shown to the user with the Python Imaging Library?
Thank you =)