Jun-02-2020, 11:49 PM
I'm using tkinter to create a login system. The main window goes as:
But when I try to load an image on a Toplevel, the sub-window just keeps blank no matter how I change the pic:
my_window=tkinter.Tk()
my_window.title('Welcome To Login System 1.0 !')
my_window.geometry('639x591')
my_canvas=tkinter.Canvas(my_window, height=639, width=591)
welcome_image=ImageTk.PhotoImage(Image.open('welcome2.png'))
image=my_canvas.create_image(0,0, anchor='nw',image=welcome_image)
my_canvas.pack(side='top')and it works pretty fine.But when I try to load an image on a Toplevel, the sub-window just keeps blank no matter how I change the pic:
signup_window=tkinter.Toplevel(my_window)
signup_window.geometry('500x400')
signup_window.title('Sign up now')
signup_canvas = tkinter.Canvas(signup_window, height=500, width=400)
signup_image = ImageTk.PhotoImage(Image.open('signup_bg.png'))
image2 = signup_canvas.create_image(0, 0, anchor='nw', image=signup_image)
signup_canvas.pack(side='top')Don't know what goes wrong. I use the PIL module to load the image.
