Python TkInter:图片未显示。我究竟做错了什么?

时间:2019-03-01 05:43:28

标签: python image class user-interface tkinter

我的代码:

...

recomlist = []
class recomclass:
        def recomfunc(self,a,b,c,d):
                self.recomphoto = PhotoImage(file=a)
                self.recomphotolabel = Button(bottompanel, image=self.recomphoto, width=463, height=293)
                recomphotolabel.grid(column=b)
                global recomlist
                recomlist += [a]


                self.recomname = Label(bottompanel, text=c, bg="red4", fg="white", font=("Arial", 30))
                self.recomname.place(x=d, y=255)


sobarecom = recomclass()
risottorecom = recomclass()
lasagnerecom = recomclass()


sobarecom.recomfunc("Soba Noodles.ppm", 0, "Soba Noodles", 0)
risottorecom.recomfunc("Mushroom Risotto.ppm", 1, "Mushroom Risotto", 463)
lasagnerecom.recomfunc("Pizza.ppm", 2, "Lasagne", 926)

...

仅显示第一个图像,而不显示三个图像,而显示其他两个图像的框架背景。我在做什么错了,该如何解决?

0 个答案:

没有答案