First of all, thank you for taking the time to look at and read my question. What I'm trying to do is to make the font of a TTK button bold. It is very easy to do with a normal Tkinter button, but I'm having a little trouble with a TTK one.
Here's what I have for a normal Tkinter button:
boldFont = Font (size = 10, weight = "bold")
boldButton = Button (formatBar, text = "B", width = 2, font = boldFont)
boldButton.pack (side = LEFT, padx = 1, pady = 1)
And that achieves what I would like, but when I try the same thing with a TTK button (using a TTK style instead of a font), it doesn't make the text bold.
TTK button:
boldStyle = ttk.Style ()
boldStyle.configure ("Bold.TButton", size = 10, weight = "bold")
boldButton = ttk.Button (formatBar, text = "B", width = 2, style = "Bold.TButton")
boldButton.pack (side = LEFT, padx = 1, pady = 1)
I'm probably just being a little stupid, but I can't find any way to fix this. I've done a little research and tried converting some TCL code, but none of it works.
Try this:
boldStyle.configure("Bold.TButton", font = ('Sans','10','bold'))
boldButton = ttk.Button(formatBar, text = "B", width = 2, style = "Bold.Button")
Found it here.
You could of course change the font type to any type you like (if available :))
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