我尝试将图像放在标签内,但它只是显示一个没有图像的白框。我还尝试将其放在app = APP()之后,但说创建图像还为时过早。请帮助...
from tkinter import *
import tkinter as tk
class HomePage(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
photo1=PhotoImage(file="phy.gif")
button = tk.Button(self, text="Topics",font="Arial
20",bg="#1F2833",fg="#C5C6C7",bd=5, command=lambda:
controller.show_frame(TopicPage))
button.place(width=200, height=50, x=0, y=0)
button1 = tk.Button(self, text="About",font="Arial
20",bg="#1F2833",fg="#C5C6C7",bd=5, command=lambda:
controller.show_frame(AboutPage))
button1.place(width=200, height=50, x=200, y=0)
label= tk.Label(self, text="\n\n Physics Equation Simulator\n",
fg="#66FCF1", bg="#1F2833", font="Algerian 36 bold")
label.place(x=85, y=100)
label1= tk.Label(self, image=photo1)
label1.place(x=200, y=300)
app = APP()
app.geometry("900x600")
app.resizable(0, 0)
app.mainloop()