im trying to add dynamically resizable logo (png image) to my customtkinter window. But its going in a loop and dont work.
Here is the part of my code.
# window
app = ctk.CTk()
app.title("OmniMatrix 3000")
app.geometry("800x500")
# Starting mesure
last_width = 800
last_height = 500
# Logo resize func
def resize_image(event):
global last_width, last_height
new_width = event.width
new_height = event.height // 4 # Yüksekliği pencerenin 1/4'ü olarak ayarladım
image = Image.open("testsurum/logo.png")
resized_image = image.resize((new_width, new_height), Image.Resampling.LANCZOS)
photo = ImageTk.PhotoImage(resized_image)
logo_label.configure(image=photo)
logo_label.image = photo
# First logo upload
image = Image.open("testsurum/logo.png")
photo = ImageTk.PhotoImage(image)
logo_label = ctk.CTkLabel(app, text="", image=photo)
logo_label.pack(pady=10)
# resize
app.bind("<Configure>", resize_image)
New contributor
Zekeriya Baştürk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.