0
view = Tk()
view.title("Title")
view.geometry('600x600')
view.attributes("-fullscreen",True)

def resize_image(event):
    new_width = event.width
    new_height = event.height
    image = copy_of_image.resize((new_width, new_height))
    photo = ImageTk.PhotoImage(image)
    label.config(image = photo)
    label.image = photo 
image = Image.open('add.png')
copy_of_image = image.copy()
photo = ImageTk.PhotoImage(image)
label = ttk.Label(view, image = photo)
label.bind('<Configure>', resize_image)
label.pack(fill=BOTH, expand = YES)
command="pwd"

def changePicture():
    print("I change picture")
    image2 = Image.open('add.png')
    copy_of_image = image2.copy()
    photo = ImageTk.PhotoImage(image2)
    label = ttk.Label(view, image = photo)
    label.image=image2
    label.pack()

It just stands and can't change picture. I got other codes to "add.png" image. Just window stays still and no change. Thanks foryour help guys in advance.

Mr Bozkurt
  • 37
  • 1
  • 8
  • ***"Just window stays still and no change"***: it's likely you block the `.mainloop()`. E.g. [Freezing during the execution of a function](https://stackoverflow.com/questions/10847626/program-freezing-during-the-execution-of-a-function-in-tkinter) – stovfl Oct 06 '19 at 14:47

1 Answers1

0

change the line:

label.pack(fill=BOTH, expand = YES)

to

label.pack()
  • Has no effect bro. I call changePicture function with timer later. Can it cause that? But see this works while changing, however I can't make it fit to windows. Images are as small as their original size's. [ImageChange however it can't fit](https://stackoverflow.com/questions/58234618/how-can-i-change-the-picture-inside-tkinter) – Mr Bozkurt Oct 06 '19 at 16:00