from tkinter import * from PIL import ImageTk, Image #python pip install Pillow root = Tk() def image(): new = Tk() canvas = Canvas(new, height=400, width=400) canvas.pack() my_image = ImageTk.PhotoImage(file='2.jpg', master= new) canvas.create_image(0, 0, anchor=NW, image=my_image) new.mainloop() btn = Button(text = "Home") btn.config(command = image) btn.pack() canvas = Canvas(root, height=600, width=600) canvas.pack() my_image = ImageTk.PhotoImage(file='1.jpg', master= root) canvas.create_image(0, 0, anchor=NW, image=my_image) root.mainloop()