Tkinter : j'essaie de mettre une image dans un canevas : erreur
Résolu
Fabio
-
medet -
medet -
Bonjour, je commence à programmer en python, alors j'ai voulu commencer à créer un petit jeu, mais au moment de mettre une image en fond voila que :
Voici mon code :
J'ai cherché sur internet mais je comprends paaaaas.
S'il vous plaît aidez moaaaaaaaaaaa !!!
/usr/bin/python3.5 "/home/fabio/Documents/Jeu/Save your phone !!!.py"
Traceback (most recent call last):
File "/home/fabio/Documents/Jeu/Save your phone !!!.py", line 16, in <module>
app = fenetre()
File "/home/fabio/Documents/Jeu/Save your phone !!!.py", line 13, in __init__
self.game.create_image(0,0,fond)
File "/usr/lib/python3.5/tkinter/__init__.py", line 2332, in create_image
return self._create('image', args, kw)
File "/usr/lib/python3.5/tkinter/__init__.py", line 2323, in _create
- (args + self._options(cnf, kw))))_tkinter.TclError: unknown option "pyimage1"
Voici mon code :
#!/usr/bin/python # -*- coding: utf-8 -* import tkinter root = tkinter.Tk() fond = tkinter.PhotoImage(file='herbe.gif') class fenetre (tkinter.Tk) : def __init__(self): super(fenetre, self).__init__() self.game=tkinter.Canvas(height=500, width=500) self.game.pack() self.game.create_image(0,0,fond) if __name__ == '__main__': app = fenetre() app.title('Save your phone !!!') app.mainloop()
J'ai cherché sur internet mais je comprends paaaaas.
S'il vous plaît aidez moaaaaaaaaaaa !!!
A voir également:
- _tkinter.tclerror: unknown option "pyimage1"
- Tkinter tableau - Forum Python
- Probleme tkinter injustifier - Forum Python
- Pygame ou tkinter ? - Forum Python
- Probleme collision avec tkinter - Forum Python
- Problème avec grid tkinter ✓ - Forum Python