Azure-ttk-theme
Azure-ttk-theme copied to clipboard
Unable to change the font of ttk.Entry and ttk.Label
Using ttk.Style() there is no impact on the font for both Entry and Label.
My code is as follows:
ttk.Style().configure("TEntry", font=("Righteous", 13 * -1), foreground="red")
ttk.Style().configure("TLabel", font=("Righteous", 13 * -1), foreground="red")
It seems to work at changing the color but fails to update the font.
There is also a slight naming inacuracy with
ttk.Style().configure("Label", font=("Righteous", (13 + size * 2) * -1), foreground="orange")
According to the docs it should be 'TLabelFrame' rather than just 'Label'
I have attached an image of the issue, the font of TMenubutton changes correctly but the font of TEntry and TLabel do not change.
I haven't tried it out, but according to this page, setting the font for ttk.Entry
is not possible using a style. You have to use the config
method.
Also, it looks like you have to use a named font (from the tkinter.font
module to change the font of the Label
.
I agree you cannot change the font of TEntry using styles, but still, the other issue exists. You cannot change the font of TLabel at all.
On the default tkinter theme changing the font of TLabel works fine, butusing Azure it just refuses to work.
1.
This works for changing the font of the Label, unless it is explicitly set to something else:
ttk.Style().configure("TLabel", font=("Righteous", -13), foreground="red")
2.
according to this page, setting the font for ttk.Entry is not possible using a style. You have to use the config method.
As I said, it's not possible to configure the font of TEntry
using a style. Even this theme can't do it.
3.
There is also a slight naming inaccuracy with
ttk.Style().configure("Label", font=("Righteous", (13 + size * 2) * -1), foreground="orange")
According to the docs it should be 'TLabelFrame' rather than just 'Label'
No, it should be simply Label
, which is the actual label component of the labelframe, the LabelFrame
style class will configure the frame itself.