This is my problem, I was building an interface for a program, but for needs of the bosses, the font must be larger. I have changed the font size of every widget without any problem, but with the ttk.Buttons, I was unable to change it... I was reading that ttk.Button doesn't support the font attribute, but tk.Button supports it. I tried with tk.Button and it works, but I don't like the graphic style of this tk.Button...
Is there any way to change the font style and size of a ttk.Button, or changed the graphic style of the tk.Button to make similar to the ttk?
Thanks to everyone!
In the given output, there are two ttk buttons which are having different properties such as font size and color. We can modify the font size by updating the values in the configuration.
To change the font size of a button, use the font-size property.
We can customize the font-property of text widget in a tkinter application using the font('font-family',font-size, 'style') attribute.
You have to use styles to customize ttk
widgets.
s = ttk.Style()
s.configure('my.TButton', font=('Helvetica', 12))
b = ttk.Button(mainframe, text='Press me', style='my.TButton',
command=foo)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With