Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change a Button widget's text size?

Tags:

python

tkinter

I have been looking all over Google and SO for something that might help me with this seemingly simple problem.

I have a button in Tkinter and I want its weight to be bold. I've tried this:

test = Button(..., text="Test", font=("Arial",10,"bold"), command=...)

And this:

test = Button(..., text="Test", font="Arial 10 bold", command=...)

But both return unknown option -font errors.

Any help would be greatly appreciated.

like image 306
noblerare Avatar asked Nov 27 '25 06:11

noblerare


1 Answers

Can you please cut and paste the whole error you get? font is most definitely an option for the tkinter Button class.

My guess is, when you think you are creating a tkinter Button widget, you're creating something different -- maybe a ttk Button widget which doesn't support the font attribute.

like image 194
Bryan Oakley Avatar answered Nov 29 '25 19:11

Bryan Oakley



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!