0

I tried calling the image the first file

File 1

from tkinter import *
from File2 import New
window = Tk()

path = "Images/istockphoto-638149354-612x612.jpg"

new_window = New(window, path)
btn = Button(text="new user", command=new_window.window)

File 2

from tkinter import *
from PIL import ImageTk, Image


class New:
    def __init__(self, window, path):
        self.window = window
        self.path = path

    def NewWindow(self):
        win = Toplevel(self.window)
        win.title("New Window")
        win.state("zoomed")
        
        img = ImageTk.PhotoImage(Image.open(self.path))
        my_label = Label(win, image=img, bg="skyblue", highlightthickness=0)
        my_label.pack(fill="both", expand="yes")`

I want it to be display the image the in new window each time it is called using the button in file 1.

JRiggles
  • 4,847
  • 1
  • 12
  • 27

0 Answers0