带有Python 3.6 ImageTk的MacOS不显示图像

时间:2018-08-10 16:31:09

标签: python-3.x macos python-imaging-library

我一直在为此应用程序编写GUI,并且在Windows上使用下面显示的代码看起来还不错。但是由于某种原因,当我在Mac上运行相同的代码时,应该在该照片上只有一个空白。我用来生成照片所在区域的代码如下所示。

csvarea = Frame(top)
pluggy = Image.open(r'./pluggy.png').convert("RGBA").resize((115, 125))
img = ImageTk.PhotoImage(pluggy)
plabel = Label(csvarea, image=img)
plabel.img = img
plabel.pack(padx=10, pady=10)
loadtitle = Label(csvarea, text="CSV status", font="TkDefaultFont 16 bold")
loadtitle.pack(fill="y", expand=True)
plabel.bind("<Button-1>", trap)
csvstatus = Label(csvarea, textvariable=loadstatus)
csvstatus.pack()
availfields = Label(csvarea, textvariable=available)
availfields.pack(fill="y", expand=True)

当我在Windows 10上运行该程序时,得到的GUI可以在README.md here上找到。但是,在Mac上,它看起来像这样:

Screenshot of Pluggy on MacOS

任何想法都将不胜感激。

0 个答案:

没有答案