I am creating a python board game, but i cant even put my board on my GUI! I am using:
from tkinter import *
root = Tk()
panel = Label(root, image = "board.gif")
panel.pack(side = "bottom", fill = "both", expand = "yes")
root.mainloop()
But it returns:
Traceback (most recent call last):
File "/Users/GAMEKNIGHT7/Desktop/genius hour/chineseCheckersAI(genius hour).py", line 3, in <module>
label = Label(image="board.gif")
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tkinter/__init__.py", line 2760, in __init__
Widget.__init__(self, master, 'label', cnf, kw)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tkinter/__init__.py", line 2293, in __init__
(widgetName, self._w) + extra + self._options(cnf))
_tkinter.TclError: image "board.gif" doesn't exist
What happened? How can i do this?
You must use the PhotoImage class: