Salut,
je sais que le sujet a déja beaucoup été traité mais je n'ai rien trouvé pour mon problème:
j'essaye d'ouvrir une image avec PIL sur python 2.7:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
import tkinter as tk
 
fenetre = tk.Tk()
 
photo = tk.PhotoImage(file='/home/pi/Desktop/2007 Trial Chile/BILD0001.jpg')
 
label = tk.Label(fenetre, image=photo)
label.pack()
 
fenetre.mainloop()
mais python me renvoie le message d'erreur:

============== RESTART: /home/pi/Desktop/testouvertureimage.py ==============
Traceback (most recent call last):
File "/home/pi/Desktop/testouvertureimage.py", line 5, in <module>
photo = tk.PhotoImage(file='/home/pi/Desktop/2007 Trial Chile/BILD0001.JPG')
File "/usr/lib/python3.5/tkinter/__init__.py", line 3406, in __init__
Image.__init__(self, 'photo', name, cnf, master, **kw)
File "/usr/lib/python3.5/tkinter/__init__.py", line 3362, in __init__
self.tk.call(('image', 'create', imgtype, name,) + options)
_tkinter.TclError: couldn't recognize data in image file "/home/pi/Desktop/2007 Trial Chile/BILD0001.jpg"
>>>
comment je peux faire pour changer ca et qu'il ouvre l'image (sachant que je travaille sur un raspberry pi)?
merci d'avance