Closed dddddgz closed 6 months ago
Yes, please fix this!!
Yes, I want to change the font size of Button, but it show the same error.
Does anyone know how to fix this? Otherwise I'd have to use the tkinter GUI.
I don't know where the thought came from that you can change the font of a themed button, because the idea is that you don't (manual page for reference: https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_button.html). The Label
widget is the only exception.
Instead you can configure the style class that is applied to the button. Like this:
from ttkbootstrap import *
window = Window("title for bug report")
Style().configure("TButton", font=("Microsoft Yahei UI", 20))
button = Button(window, text="Spam ham egg")
button.pack()
window.mainloop()
I roughly understand what you mean. Does it mean that only Label can set the font parameter straightly?
Yes. (Aand plain, non-themed tkinter
widgets too, but that's irrelevant).
Thanks for the quick reply.
Desktop (please complete the following information):
ttkbootstrap Version: 1.10.1 Python Version: Python 3.9.9 OS: Windows 10 22H2 Home Edition 19045.2965 This is what pip shows:
Describe the bug
Below is my code:
Error messages:
To Reproduce
test.py
.Expected behavior
I want to achieve effect that can change the font to microsoft yahei ui, and change the font size to 20. But it raised an error message, it shows attribute
font
is unknown option.Screenshots
The following is a screenshot of error:![Snipaste_2023-07-13_15-03-54](https://github.com/israel-dryer/ttkbootstrap/assets/134162766/3d608ff8-cc0c-49c5-b3b4-22d4908284cd)
Additional context
This is weird because the
font
attribute works just fine on tkinter and other ttkbootstrap controls (e.g. Label).In addition, I tried to use tkinter.Button instead, but tkinter does not support bootstyle.
Thanks!