用法:
layout(style, layoutspec=None)
為給定的
style
定義小部件布局。如果省略layoutspec
,則返回給定樣式的布局規範。layoutspec
,如果指定,應該是一個列表或其他序列類型(不包括字符串),其中每個項目應該是一個元組,第一個項目是布局名稱,第二個項目應該具有 Layouts 中說明的格式 .要了解格式,請參閱以下示例(它不打算做任何有用的事情):
from tkinter import ttk import tkinter root = tkinter.Tk() style = ttk.Style() style.layout("TMenubutton", [ ("Menubutton.background", None), ("Menubutton.button", {"children": [("Menubutton.focus", {"children": [("Menubutton.padding", {"children": [("Menubutton.label", {"side": "left", "expand": 1})] })] })] }), ]) mbtn = ttk.Menubutton(text='Text') mbtn.pack() root.mainloop()
相關用法
- Python tkinter.ttk.Style.lookup用法及代碼示例
- Python tkinter.ttk.Style.map用法及代碼示例
- Python tkinter.ttk.Style.theme_settings用法及代碼示例
- Python tkinter.ttk.Style.configure用法及代碼示例
- 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.layout。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。