I am creating artificial intelligence to play Chinese checkers with Python, but I can't even get an image of a board to show up!
I am using this code:
from tkinter import *
root = Tk()
board = PhotoImage(file="board.ppm")
root.mainloop()
I get the following error:
Traceback (most recent call last):
File "/Users/GAMEKNIGHT7/Desktop/genius hour/chineseCheckersAI(genius hour).py", line 3, in <module>
board = PhotoImage(file="board.ppm")
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tkinter/__init__.py", line 3539, in __init__
Image.__init__(self, 'photo', name, cnf, master, **kw)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tkinter/__init__.py", line 3495, in __init__
self.tk.call(('image', 'create', imgtype, name,) + options)
_tkinter.TclError: couldn't recognize data in image file "board.ppm"
I placed the code file in the same file as the image. What happened? How can I fix it?