【发布时间】:2018-10-05 07:52:04
【问题描述】:
我不断收到错误消息,TclError: image "pyimage8" doesn't exist。
很奇怪,每次运行的时候数字都会增加?
我正在使用 spyder 运行 python,不知道这是否会影响任何东西。
这是我的代码:
#import tkinter
import Tkinter as tk
homescreenImage = PhotoImage(file="Homescreen.gif")
#create a GUI window.
root = Tk()
#set the title.
root.title("Welcome to the Pit!")
#set the size.
root.geometry("1100x700")
homescreenFrame = tk.Frame(root, width=1100, height = 700)
homescreenFrame.pack()
homescreenLabel = tk.Label(homescreenFrame, image=homescreenImage)
homescreenLabel.pack()
#start the GUI
root.mainloop()
【问题讨论】:
-
图片是否在运行此脚本的同一文件夹中?
-
这段代码抛出各种错误。请发帖minimal reproducible example。