我正在制作一个使用 2 个不同图像的程序。我有加载页面,它只是一张名为“loading.png”的图片,效果很好。
当我尝试使用相同的方法将名为“table.png”的不同图像添加到不同的窗口时,它不会显示,但在介绍窗口中会显示我想要的图像。
这是加载屏幕代码
win=Tk()
win.title('PokerChamp')
win.geometry('400x200')
background_image = PhotoImage(file='loading.png')
background_label = Label(win, image=background_image)
background_label.place(x=0, y=0, relwidth=1, relheight=1)
这工作正常,但是当我添加此代码时,它显示错误的图像并且主窗口的图像不显示。
root=Tk()
root.withdraw()
root.config(bg='#1b800b')
root.title('PokerChamp')
image = PhotoImage(file='table.ppm')
label = Label(win, image=image)
label.place(x=0, y=0)
有任何想法吗?