我正在尝试在tk.Treeview中插入多张图像(每行一张)。但是,当我尝试使用以下代码执行此操作时:
<button onclick="generatePlate()">Generate</button>
<br />
<textarea id="output"></textarea>
它产生了此结果(输出了Pyvar名称):
在这里定义tk.PhotoImage
for i in myresults:
if i[2]==("None"):
continue
print(i[0])
# Get PatrolLeader Name
FindPL=("SELECT firstname,secondname FROM scoutinfo WHERE scoutID=%s")
mycursor.execute(FindPL,(i[1],))
mypl=mycursor.fetchall()
print(mypl)
myplname=(mypl[0][0])+(" ")+(mypl[0][1])
print(myplname)
# Get AssistantPatrolLeader Name
FindAPL=("SELECT firstname,secondname FROM scoutinfo WHERE scoutID=%s")
mycursor.execute(FindAPL,(i[2],))
myapl=mycursor.fetchall()
print(myapl)
myaplname=(myapl[0][0])+(" ")+(myapl[0][1])
if i[0]==("Raven"):
PatrolView.insert("", "end", text="", values=(RavenImage, i[0], myplname, myaplname, i[3]))
if i[0]==("Lion"):
...
这是特定行,其中“插入”了图像
RavenImage = tk.PhotoImage(file="Raven.png")