jeudi 20 mai 2021

How do I show pictures in Python and not in my folder?

I have a very simple question and maybe I'm just too stupid but here we go.

So I want to show random pictures from a file in a Python window. So I have this code until now and it works but it shows me the picture on my own computer and NOT in Python itself. How do I do that? I know how to show one single picture in a Python window but not several random pictures. Thanks. :)

from PIL import Image
path = r"PicturesEmotion"
files = os.listdir(path)
randomFile = random.choice(files)
print(randomFile)
imagepictures = Image.open(path + '/' + randomFile)
imagepictures.show(randomFile)



Aucun commentaire:

Enregistrer un commentaire