0

So I'm experimenting With Tkinter message boxes And I'm trying to insert an image in my toplevel window>

from tkinter import*
from tkinter import messagebox
root = Tk()
root.title('Hi')
root.iconbitmap('C:/Users/davids/Downloads/i2.ico')
e = Entry(root,borderwidth=8,width=35)
top = Toplevel()


def popup():
    mg = messagebox.askyesno("Warning", "Click yes/No.")
    if mg == True:
        top = Toplevel()
        top.geometry('1200x1200')
        b= Label(top, text="hi")
        b.pack()
        image = PhotoImage(file="path")
        Label(root, image=image).pack()
        
Button(root,text="Ask question", command=popup).pack()

root.mainloop()

However when I run this code nothing shows. There isn't an error so I can't see what I'm doing wrong. Only the text is displayed. I've tried adding root. but that still doesn't fix it. Please note that I do know that it is easier to use PIL however my new operating system won't install it for some reason so I'm trying to find a way without Pillow. Any idea what is happening?

0 Answers0