问题描述
这是我的问题,我正在为程序构建接口,但是出于老板的需要,字体必须更大.我已经毫无问题地更改了每个小部件的字体大小,但是使用ttk.Buttons时,我无法对其进行更改...我在读ttk.Button不支持font属性,但是tk.Button支持它.我尝试使用tk.Button并成功,但我不喜欢此tk.Button的图形样式...
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...
是否可以更改ttk.Button的字体样式和大小,或更改tk.Button的图形样式以使其类似于ttk?
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?
谢谢大家!
推荐答案
您必须使用样式以自定义 ttk
小部件.
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)
这篇关于如何在ttk.Button中更改字体大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!