用法:
theme_settings(themename, settings)
暫時將當前主題設置為
themename
,應用指定的settings
然後恢複之前的主題。settings
中的每個鍵都是一個樣式,每個值都可能包含鍵 ‘configure’, ‘map’, ‘layout’ 和“元素創建”,它們應該具有與方法Style.configure()
、Style.map()
、Style.layout()
和Style.element_create()
。例如,讓我們稍微改變一下默認主題的 Combobox:
from tkinter import ttk import tkinter root = tkinter.Tk() style = ttk.Style() style.theme_settings("default", { "TCombobox": { "configure": {"padding": 5}, "map": { "background": [("active", "green2"), ("!disabled", "green4")], "fieldbackground": [("!disabled", "green3")], "foreground": [("focus", "OliveDrab1"), ("!disabled", "OliveDrab2")] } } }) combo = ttk.Combobox().pack() root.mainloop()
相關用法
- Python tkinter.ttk.Style.map用法及代碼示例
- Python tkinter.ttk.Style.layout用法及代碼示例
- Python tkinter.ttk.Style.configure用法及代碼示例
- Python tkinter.ttk.Style.lookup用法及代碼示例
- Python tkinter.tix.Tk用法及代碼示例
- Python tkinter.tix.tixCommand用法及代碼示例
- Python torch.distributed.rpc.rpc_async用法及代碼示例
- Python torch.nn.InstanceNorm3d用法及代碼示例
- Python tf.compat.v1.distributions.Multinomial.stddev用法及代碼示例
- Python tf.compat.v1.distribute.MirroredStrategy.experimental_distribute_dataset用法及代碼示例
- Python torchaudio.transforms.Fade用法及代碼示例
- Python tf.compat.v1.data.TFRecordDataset.interleave用法及代碼示例
- Python tf.summary.scalar用法及代碼示例
- Python tf.linalg.LinearOperatorFullMatrix.matvec用法及代碼示例
- Python tf.linalg.LinearOperatorToeplitz.solve用法及代碼示例
- Python tf.raw_ops.TPUReplicatedInput用法及代碼示例
- Python tf.raw_ops.Bitcast用法及代碼示例
- Python tf.compat.v1.distributions.Bernoulli.cross_entropy用法及代碼示例
- Python Pandas tseries.offsets.CustomBusinessHour.onOffset用法及代碼示例
- Python torch.special.gammaincc用法及代碼示例
注:本文由純淨天空篩選整理自python.org大神的英文原創作品 tkinter.ttk.Style.theme_settings。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。