我正在创建人工智能来用 Python 玩中国跳棋,但我什至无法显示棋盘的图像!
我正在使用此代码:
from tkinter import *
root = Tk()
board = PhotoImage(file="board.ppm")
root.mainloop()
我收到以下错误:
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"
我将代码文件放在与图像相同的文件中。发生了什么?我该如何解决?
收到一只叮咚
相关分类