我目前正在制作AI,但是我尝试添加图像,但是tkinter窗口上没有任何显示。文本看起来很好,只是没有显示图像。这是我的代码:
import time
import tkinter
window = tkinter.Tk()
window.title("JOHN - AI Assistant")
text = tkinter.Label(window, text = "JOHN", width=30)
text.pack()
text = tkinter.Label(window, text = "Your AI Assistant", width=30)
text.pack()
def neutral_john():
canvas= Canvas(window, width = 5005, height = 500)
image_1 = PhotoImage(file="D:\\Python\\JOHN AI Assistant\\img\\john-neutral.jpeg")
canvas.create_image(0, 0, anchor = NW, image=image_1)
canvas.pack()