vendredi 24 novembre 2017

Manipulation of the viewing frequency of an image

I have a code that will open an image in a folder and display it randomly. What I want to control is the ability to close the image after a set time before the next image is shown, otherwise I have so many windows of images opened when the code is done. I.e. say when an image is shown it is displayed for 1 sec before the next image is shown. How do I control that time limit as well as being able to close it before the next image is shown. Below, is the code. Thank you in advance.

import os, random number=int(input('enter a number'))

while (number>1): folder=r"C:\Users\Chandy\Desktop\notes"

a=random.choice(os.listdir(folder))
print(a)

from PIL import Image
file = folder+'\\'+a
Image.open(file).show()

number=number-1 




Aucun commentaire:

Enregistrer un commentaire