【发布时间】:2013-06-28 19:10:22
【问题描述】:
我现在在 * 上搜索了一段时间以找到答案,但没有任何运气!在我的 Mac 上使用 tkinter 和 PIL 显示图像时遇到问题。他们只是无法在正在运行的应用程序中找到图像。这是我的 Python 课程的最后一部分,我真的需要让它完成课程。这是我收到的错误消息。
Traceback (most recent call last):
File "/Users/andrej/Documents/untitled", line 19, in <module>
imageFile = Image.open("Signori.png")
这是我的代码:
import Image
import ImageTk
import Tkinter
def new():
wind = Tkinter.Toplevel()
wind.geometry('600x600')
imageFile2 = Image.open("nesta.png")
image2 = ImageTk.PhotoImage(imageFile2)
panel2 = Tkinter.Label(wind , image=image2)
panel2.place(relx=0.0, rely=0.0)
wind.mainloop()
master = Tkinter.Tk()
master.geometry('600x600')
imageFile = Image.open("Signori.png")
image1 = ImageTk.PhotoImage(imageFile)
panel1 = Tkinter.Label(master , image=image1)
panel1.place(relx=0.0, rely=0.0)
B = Tkinter.Button(master, text = 'New image', command = new).pack()
master.mainloop()
【问题讨论】:
-
您没有发布整个异常跟踪 - 引发的实际错误是什么?
标签: python-2.7 tkinter python-imaging-library