I'm trying to make the background image rescale with the window size, but it's not working. How come? how can I solve this?
from tkinter import *
from PIL import Image, ImageTk
window = Tk()
window.geometry("1300x700")
window.title('Monopoly')
background_image = PhotoImage(file="board.png")
background_label = Label(window, image=background_image)
background_label.place(x=0, y=0, relwidth=1, relheight=1)
background_label.pack()
def resizer(event):
global bg1, resized_bg, new_bg
bg1 = Image.open('board.png')
resized_bg = bg1.resize((event.width, event.height))
new_bg = PhotoImage(resized_bg)
background_label.config(image=new_bg)
label = Label(window, text='this is a test').pack()
window.bind('<Configure>', resizer)
window.mainloop()