试图改变一个Checkbutton的样式,我只是好奇是否有可能改变方框本身的大小?在
这就是我目前所拥有的。尝试了configure部分中的'height'和'width',但似乎找不到。在
s = ttk.Style()
s.theme_use('default')
s.configure("cbutton.TCheckbutton", foreground='#ebebeb', background='#5c5c5c', font=("arial", 14))
s.theme_settings("default",
{"TCheckbutton": {
"configure": {"padding": 5},
"map": {
"background": [("active", "#5C5C5C"),("!disabled", "#5C5C5C")],
"fieldbackground": [("!disabled", "#5C5C5C")],
"foreground": [("focus", "lightgray"),("!disabled", "lightgray")], "indicatorcolor": [('selected','#9ac947'),('pressed','#9ac947')]
}
}
})
这可能吗?在
谢谢!在
ttk中的指示符元素支持}。这些都被设置为使用
background
、borderwidth
、indicatorcolor
、indicatorrelief
、indicatordiameter
和{style.configure()
作为小部件样式的主题配置值。您可以通过更改indicatordiameter
来更改Tk绘制主题的指示符元素的大小。例如:它将标准checkbutton样式(TCheckbutton)复制到新样式中,然后覆盖自定义样式的指示器大小。在
注意,对于使用不是由Tk绘制的指示符元素的主题,这将不受支持。例如,Windows主题的指示符元素是由视觉样式API提供的,它的大小由系统定义的主题引擎决定。如果必须启用这种主题自定义,则可以将指示符元素从“默认”主题导入到windows主题中,但代价是使应用程序的某些部分在该平台上看起来奇怪,因为UI的外观开始不匹配。在
相关问题 更多 >
编程相关推荐