Image dans un canevas et bug :(
C'est un sujet ultra connu mais je n'ai rien trouvé qui me corresponde donc j'espère avoir votre aide:
Code:
1 2 3 4 5 6 7 8
| def valider():
global nom_fichier_autres, nom_fichier_fond, geo25, geo15
miniature = Tk()
miniature.title("Miniature")
can = Canvas(miniature, width = 1280, height = 720)
can.pack()
fond = PhotoImage(file = nom_fichier_fond)
can.create_image(640, 360, anchor = CENTER, image = fond) |
Et en retour j'ai cette erreur:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/idlelib/run.py", line 119, in main
seq, request = rpc.request_queue.get(block=True, timeout=0.05)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/queue.py", line 172, in get
raise Empty
queue.Empty
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/tkinter/__init__.py", line 1549, in __call__
return self.func(*args)
File "/Users/Victor/Google Drive/Programmation/Miniatures/Miniatures Creator.py", line 14, in valider
can.create_image(640, 360, anchor = NW, image = fond)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/tkinter/__init__.py", line 2328, in create_image
return self._create('image', args, kw)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/tkinter/__init__.py", line 2319, in _create
*(args + self._options(cnf, kw))))
_tkinter.TclError: image "pyimage1" doesn't exist |
En attendant avec impatience vos réponses.