Bonjour,
J'ai un probleme avec mon canvas: quand j'essaye de faire un create_image, ça me donne l'erreur suivante:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 
Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Python27\lib\lib-tk\Tkinter.py", line 1410, in __call__
    return self.func(*args)
  File "C:\Users\FLORENT\workspace\ProjetPython\src\controleurs\ControleurInterfaceAccueil.py", line 56, in lancerJeu
    ControleurInterfaceJeu(self.getClient())
  File "C:\Users\FLORENT\workspace\ProjetPython\src\controleurs\ControleurInterfaceJeu.py", line 26, in __init__
    self.interface = InterfaceJeu(self.master,self)
  File "C:\Users\FLORENT\workspace\ProjetPython\src\Vues\InterfaceJeu.py", line 84, in __init__
    self.__canvas.create_image(400,260,image=PhotoImage(file="C:/Users/FLORENT/workspace/ProjetPython/src/Vues/images/tapis.gif"))
  File "C:\Python27\lib\lib-tk\Tkinter.py", line 2198, in create_image
    return self._create('image', args, kw)
  File "C:\Python27\lib\lib-tk\Tkinter.py", line 2189, in _create
    *(args + self._options(cnf, kw))))
TclError: image "pyimage3" doesn't exist
pouvez vous m'aider ?

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
 self.__canvas = Canvas(self.frame, width=900, height=640, bg="dark green")
        self.__images = []
        self.__images.append(PhotoImage(file="C:/Users/FLORENT/workspace/ProjetPython/src/Vues/images/tapis.gif"))
        self.__canvas.create_image(400,260,image=PhotoImage(file="C:/Users/FLORENT/workspace/ProjetPython/src/Vues/images/tapis.gif"))
        self.__canvas.pack()