如何更改主題按鈕小部件中的字體和字體大小(ttk::button
)?如何更改ttk :: button(主題小工具)中的字體和字體大小?
ttk::button .x.buttonTEST -text "TEST" -font ??
# the -font option is not valid with ttk::button
如何更改主題按鈕小部件中的字體和字體大小(ttk::button
)?如何更改ttk :: button(主題小工具)中的字體和字體大小?
ttk::button .x.buttonTEST -text "TEST" -font ??
# the -font option is not valid with ttk::button
一個TTK ::按鈕的外觀(尤其是你的,它的字體,但其他的一些東西)是僅通過風格和主題進行控制。通過設置一次樣式,將它應用到許多按鈕變得很容易(假設這是你想要的)。
要做到這一點,最簡單的方法是使派生的風格,這是由前面加上一些自定義的前綴到現有的基本樣式(TButton
的按鈕)來完成。
# Once per style in your program...
ttk::style configure MyExample.TButton -font {Symbol 48}
# For each button you want that looks this way...
ttk::button .b -font "Example" -style MyExample.TButton
pack .b
你可能會得到你想要的答案,這Tk的教程頁面:http://www.tkdocs.com/tutorial/styles.html