Reputation: 145
How can one make the font size of 'Hi' grows proportional to the size of the window when the window is resized?
import Tkinter
outer_window = Tkinter.Tk()
button_1 = Tkinter.Button(outer_window, text='Hi')
button_1.grid(sticky='nsew')
outer_window.columnconfigure(0, weight=1)
outer_window.rowconfigure(0, weight=1)
outer_window.mainloop()
Upvotes: 1
Views: 265
Reputation: 385920
There is no built-in support for this. You will have to create a binding for the <Configure>
event of the button. In the handler for the binding you'll have to get the size of the button and then compute an appropriate font size. Then, you'll have to reconfigure the font used by the button.
Upvotes: 1