2 years ago

#65168

test-img

Chorum

I want to set a new label fontsize after MousebuttonRelease (or other method after changing the window size)

i have gui window with 3 frames and 3 labels. the frames already change theyre size while resizing the window.

now i need to do the same with the fontsize of the labels.

i thought about using the tkinter event to resize the font.

the function for the event:

def leftoff(event):
    fontsize = int(window_height/10)
    return "break"

as i understand i have to bind that event to any object that i want to change, so thats my labelcode:

label1 = Label(top_frame, text="Top Frame",fg='#000000', bg = 'red')
label1.place(relx = 0.5, rely = 0.5, anchor = "center")
label1.bind("<ButtonRelease-1>",leftoff)
label1.config(font=("Courier bold", fontsize))

But the fontsize doesnt change. do i need some kind of update() for the root window ?

python

tkinter

events

mouse

0 Answers

Your Answer

Accepted video resources