如何更改 ttk::button (主题小部件)中的字体和字体大小?
如何更改主题按钮小部件 (ttk::button
) 中的字体和字体大小?
ttk::button .x.buttonTEST -text "TEST" -font ??
# the -font option is not valid with ttk::button
How do you change the font and font size in the themed button widget (ttk::button
)?
ttk::button .x.buttonTEST -text "TEST" -font ??
# the -font option is not valid with ttk::button
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
ttk::button 的外观(特别是对你来说,它的字体,但其他东西也是如此)完全通过样式和主题控制。通过设置一次样式,可以轻松地将其应用到许多按钮(假设这就是您想要的)。
最简单的方法是创建派生样式,这是通过在现有基本样式(按钮的
TButton
)上添加一些自定义前缀来完成的。The look of a ttk::button (in particular for you, its font, but other things too) is controlled exclusively through the style and theme. By setting up the style once, it becomes easy to apply it to many buttons (assuming that's what you want).
The simplest way to do this is to make a derived style, which is done by prepending some custom prefix onto an existing base style (
TButton
for buttons).您可能会在此 Tk 教程页面上获得所需的答案: http://www.tkdocs .com/tutorial/styles.html
You'll probably get the answers you want on this Tk tutorial page: http://www.tkdocs.com/tutorial/styles.html