Python Tkinter错误,“太早创建图像”
发布于 2021-01-29 18:59:35
因此,我必须使用Tkinter来创建棋盘游戏。这只是程序的一部分,我想在其中引入董事会形象。但是我不断收到错误消息:“创建图像为时过早”,我不确定自己做错了什么。
到目前为止,这是我的代码:
from Tkinter import *
from pprint import pprint
# Which variable is currently updating
from variableColors import Variables
VariableIndex = 0
VariableText = Variables[VariableIndex]
Ids = None # Current canvas ids of the text and 4 player tokens:
# Will be None if not committed
VariableCoords = { } # Where store variable and coordinates
im = PhotoImage(file="C:\Users\Kiki\Desktop\Assignment\\")
photo = can.create_image(0,0,anchor=NW, image=im)
can.pack()
root.mainloop()
任何帮助,将不胜感激。谢谢 :)
关注者
0
被浏览
85