tkinter.ttk 资料整理+笔记(大全)
tkinter.ttk 资料整理+笔记(大全)
- tkinter.ttk
- 一、系统常量、模块
- 1 str __name__ tkinter.ttk
- 2 str __doc__
- 3 str __package__ tkinter
- 4 SourceFileLoader __loader__
- 5 ModuleSpec __spec__
- 6 str `__file__` ……\lib\tkinter\ttk.py
- 7 str `__cached__`
- 8 dict __builtins__ {}
- 9 str __version__ 0.3.1
- 10 str
- 11 lst `__all__`
- 12 module tkinter
- 二、类
- 13 type Style <class 'tkinter.ttk.Style'>
- 1 str __module__ tkinter.ttk
- 2 str __doc__
- 3 function __init__
- 4 getset_descriptor __dict__
- 5 getset_descriptor __weakref__
- ○6 function configure
- ○7 function map
- ○8 function lookup
- ○9 function layout
- ○10 function element_create
- ○11 function element_names
- ○12 function element_options
- ○13 function theme_create
- ○14 function theme_settings
- ○15 function theme_names
- ○16 function theme_use
- Widget
- 14 type Widget <class 'tkinter.ttk.Widget'>
- 1 str __module__ tkinter.ttk
- 2 str __doc__
- 3 function __init__
- ○4 function identify
- ○5 function instate
- ○6 function state
- Button
- 15 type Button <class 'tkinter.ttk.Button'>
- 1 str __module__ tkinter.ttk
- 2 str __doc__
- 3 function __init__
- ○4 function invoke
- Checkbutton
- 16 type Checkbutton <class 'tkinter.ttk.Checkbutton'>
- 1 str __module__ tkinter.ttk
- 2 str __doc__
- 3 function __init__
- ○4 function invoke
- Entry
- 17 type Entry <class 'tkinter.ttk.Entry'>
- 1 str __module__ tkinter.ttk
- 2 str __doc__
- 3 function __init__
- ○4 function bbox
- ○5 function identify
- ○6 function validate
- Combobox
- 18 type Combobox <class 'tkinter.ttk.Combobox'>
- 1 str __module__ tkinter.ttk
- 2 str __doc__
- 3 function __init__
- ○4 function current
- ○5 function set
- Frame
- 19 type Frame <class 'tkinter.ttk.Frame'>
- 1 str __module__ tkinter.ttk
- 2 str __doc__
- 3 function __init__
- Label
- 20 type Label <class 'tkinter.ttk.Label'>
- 1 str __module__ tkinter.ttk
- 2 str __doc__
- 3 function __init__
- Labelframe
- 21 type Labelframe <class 'tkinter.ttk.Labelframe'>
- 1 str __module__ tkinter.ttk
- 2 str __doc__
- 3 function __init__
- LabelFrame
- 22 type LabelFrame <class 'tkinter.ttk.Labelframe'>
- Menubutton
- 23 type Menubutton <class 'tkinter.ttk.Menubutton'>
- 1 str __module__ tkinter.ttk
- 2 str __doc__
- 3 function __init__
- Notebook
- 24 type Notebook <class 'tkinter.ttk.Notebook'>
- 1 str __module__ tkinter.ttk
- 2 str __doc__
- 3 function __init__
- ○4 function add
- ○5 function forget
- ○6 function hide
- ○7 function identify
- ○8 function index
- ○9 function insert
- ○10 function select
- ○11 function tab
- ○12 function tabs
- ○13 function enable_traversal
- Panedwindow
- 25 type Panedwindow <class 'tkinter.ttk.Panedwindow'>
- 1 str __module__ tkinter.ttk
- 2 str __doc__
- 3 function __init__
- ○4 function forget
- ○5 function insert
- ○6 function pane
- ○7 function sashpos
- PanedWindow
- 26 type PanedWindow <class 'tkinter.ttk.Panedwindow'>
- Progressbar
- 27 type Progressbar <class 'tkinter.ttk.Progressbar'>
- 1 str __module__ tkinter.ttk
- 2 str __doc__
- 3 function __init__
- ○4 function start
- ○5 function step
- ○6 function stop
- Radiobutton
- 28 type Radiobutton <class 'tkinter.ttk.Radiobutton'>
- 1 str __module__ tkinter.ttk
- 2 str __doc__
- 3 function __init__
- ○4 function invoke
- Scale
- 29 type Scale <class 'tkinter.ttk.Scale'>
- 1 str __module__ tkinter.ttk
- 2 str __doc__
- 3 function __init__
- ○4 function configure
- ○5 function get
- Scrollbar
- 30 type Scrollbar <class 'tkinter.ttk.Scrollbar'>
- 1 str __module__ tkinter.ttk
- 2 str __doc__
- 3 function __init__
- Separator
- 31 type Separator <class 'tkinter.ttk.Separator'>
- 1 str __module__ tkinter.ttk
- 2 str __doc__
- 3 function __init__
- Sizegrip
- 32 type Sizegrip <class 'tkinter.ttk.Sizegrip'>
- 1 str __module__ tkinter.ttk
- 2 str __doc__
- 3 function __init__
- Spinbox
- 33 type Spinbox <class 'tkinter.ttk.Spinbox'>
- 1 str __module__ tkinter.ttk
- 2 str __doc__
- 3 function __init__
- ○4 function set
- Treeview
- 34 type Treeview <class 'tkinter.ttk.Treeview'>
- 1 str __module__ tkinter.ttk
- 2 str __doc__
- 3 function __init__
- ○4 function bbox
- ○5 function get_children
- ○6 function set_children
- ○7 function column
- ○8 function delete
- ○9 function detach
- ○10 function exists
- ○11 function focus
- ○12 function heading
- ○13 function identify
- ○14 function identify_row
- ○15 function identify_column
- ○16 function identify_region
- ○17 function identify_element
- ○18 function index
- ○19 function insert
- ○20 function item
- ○21 function move
- ○22 function reattach
- ○23 function next
- ○24 function parent
- ○25 function prev
- ○26 function see
- ○27 function selection
- ○28 function selection_set
- ○29 function selection_add
- ○30 function selection_remove
- ○31 function selection_toggle
- ○32 function set
- ○33 function tag_bind
- ○34 function tag_configure
- ○35 function tag_has
- LabeledScale
- 35 type LabeledScale `<class 'tkinter.ttk.LabeledScale'>`
- 1 str __module__ tkinter.ttk
- 2 str __doc__
- 3 function __init__
- ○4 function destroy
- 5 property value
- OptionMenu
- 36 type OptionMenu `<class 'tkinter.ttk.OptionMenu'>`
- 1 str __module__ tkinter.ttk
- 2 str __doc__
- 3 function __init__
- 4 function __getitem__
- ○5 function set_menu
- ○6 function destroy
- 三、函数
- ○37 function `tclobjs_to_py`
- ○38 function `setup_master`
- the End of tkinter.ttk
以下来自于:printObj(tkinter.dict), 大侠Ahcao
英文为机器自动翻译(有道)+ 人工校对。
tkinter.ttk
printObj(ttk.dict)
英文为机器自动翻译(有道)。
一、系统常量、模块
1 str name tkinter.ttk
2 str doc
Ttk包装。
这个模块提供了允许使用Tk主题小部件集的类。
Ttk基于tip#48 (http://tip.tcl.tk/48)指定样式引擎的修订和增强版本。
它的基本思想是尽可能地将实现小部件行为的代码与实现小部件外观的代码分开。
小部件类绑定主要负责维护小部件状态和调用回调,小部件外观的所有方面都位于主题。
3 str package tkinter
4 SourceFileLoader loader
<_frozen_importlib_external.SourceFileLoader object at 0x0000000002672608>
5 ModuleSpec spec
ModuleSpec(name=‘tkinter.ttk’, loader=<_frozen_importlib_external.SourceFileLoader object at 0x0000000002672608>, origin=‘……\lib\tkinter\ttk.py’)
6 str __file__
……\lib\tkinter\ttk.py
7 str __cached__
……\lib\tkinter_pycache_\ttk.cpython-37.pyc
8 dict builtins {}
9 str version 0.3.1
10 str
author Guilherme Polo ggpolo@gmail.com
11 lst __all__
[‘Button’, ‘Checkbutton’, ‘Combobox’, ‘Entry’, ‘Frame’, ‘Label’, ‘Labelframe’, ‘LabelFrame’, ‘Menubutton’, ‘Notebook’, ‘Panedwindow’, ‘PanedWindow’, ‘Progressbar’, ‘Radiobutton’, ‘Scale’, ‘Scrollbar’, ‘Separator’, ‘Sizegrip’, ‘Spinbox’, ‘Style’, ‘Treeview’, ‘LabeledScale’, ‘OptionMenu’, ‘tclobjs_to_py’, ‘setup_master’]
12 module tkinter
<module ‘tkinter’ from ‘……\lib\tkinter_init_.py’>
二、类
13 type Style <class ‘tkinter.ttk.Style’>
1 str module tkinter.ttk
2 str doc
操作样式数据库。
3 function init
<code object init at 0x0000000002692D20, file “……\lib\tkinter\ttk.py”, line 367>
4 getset_descriptor dict
<attribute ‘dict’ of ‘Style’ objects>
5 getset_descriptor weakref
<attribute ‘weakref’ of ‘Style’ objects>
○6 function configure
<code object configure at 0x0000000002692DB0, file “……\lib\tkinter\ttk.py”, line 378>
def configure(self, style, query_opt=None, **kw):
以样式查询或设置指定选项的默认值。
kw中的每个键都是一个选项,每个值都是一个字符串或一个序列,用于标识该选项的值。
○7 function map
<code object map at 0x0000000002692E40, file “……\lib\tkinter\ttk.py”, line 391>
def map(self, style, query_opt=None, **kw):
按样式查询或设置指定选项的动态值。
kw中的每个键都是一个选项,每个值都应该是一个列表或元组(通常),其中包含分组在元组、列表或其他您喜欢的东西中的状态。
一个statespec是一个或多个状态和一个值的复合。
○8 function lookup
<code object lookup at 0x0000000002692ED0, file “……\lib\tkinter\ttk.py”, line 409>
def lookup(self, style, option, state=None, default=None):
返回样式中为option指定的值。
如果指定了state,则期望它是一个或多个状态的序列。如果设置了default参数,则在没有找到option的说明时将其用作回退值。
○9 function layout
<code object layout at 0x0000000002692F60, file “……\lib\tkinter\ttk.py”, line 421>
def layout(self, style, layoutspec=None):
定义给定样式的小部件布局。
如果省略了layoutspec,则返回给定样式的布局规范。layoutspec应该是一个与None不同的列表或对象,如果你想“关闭”该样式,则该对象的值为False。
如果它是一个列表(或元组或其他东西),每个元素都应该是一个元组,其中第一项是布局名称,第二项应该具有如下所述的格式:
LAYOUTS布局机制使用包几何管理器的简化版本:给定一个初始空腔,每个元素分配一个包。有效的选项/值是:side: whichside指定放置元素的空腔的哪一边;上、右、下或左之一。如果省略,该元件将占据整个腔体。sticky: nswe指定元素在分配的包中的位置。children: [sublayout... ]指定要放置在元素中的元素列表。每个元素都是一个元组(或其他序列),其中第一项是布局名称,另一项是布局LAYOUT。
○10 function element_create
<code object element_create at 0x0000000002693030, file “……\lib\tkinter\ttk.py”, line 464>
def element_create(self, elementname, etype, *args, **kw):
在给定etype的当前主题中创建一个新元素。
○11 function element_names
<code object element_names at 0x0000000002693150, file “……\lib\tkinter\ttk.py”, line 471>
def element_names(self):
返回当前主题中定义的元素列表。
○12 function element_options
<code object element_options at 0x0000000002693270, file “……\lib\tkinter\ttk.py”, line 477>
def element_options(self, elementname):
返回elementname的选项列表。
○13 function theme_create
<code object theme_create at 0x0000000002693300, file “……\lib\tkinter\ttk.py”, line 483>
def theme_create(self, themename, parent=None, settings=None):
创建一个新主题。
如果该名称已经存在,则会出错。
如果指定了parent,新主题将从指定的父主题继承样式、元素和布局。
如果存在设置,则期望它们具有与主题设置相同的语法。
○14 function theme_settings
<code object theme_settings at 0x0000000002693390, file “……\lib\tkinter\ttk.py”, line 500>
def theme_settings(self, themename, settings):
临时设置当前主题为themename,应用指定的设置,然后恢复以前的主题。
设置中的每个键都是一种样式,每个值都可能包含键’configure’, ‘map’, ‘layout’和’element create’,
它们应该具有与分别由方法configure, map, layout和element_create指定的相同的格式。
○15 function theme_names
<code object theme_names at 0x0000000002693420, file “……\lib\tkinter\ttk.py”, line 512>
def theme_names(self):
返回所有已知主题的列表。
○16 function theme_use
<code object theme_use at 0x00000000026934B0, file “……\lib\tkinter\ttk.py”, line 517>
def theme_use(self, themename=None):
如果themename为None,则返回正在使用的主题,否则,将当前主题设置为themename,刷新所有小部件并发出 <> 事件。
Widget
14 type Widget <class ‘tkinter.ttk.Widget’>
1 str module tkinter.ttk
2 str doc
Tk主题小部件的基类。
3 function init
<code object init at 0x00000000026935D0, file “……\lib\tkinter\ttk.py”, line 535>
用父主组件构造一个Ttk小部件。
标准选项类class, cursor, takefocus, style可滚动小部件选项xscrollcommand, yscrollcommandLABEL小部件选项text, textvariable, underline, image, compound, width小部件状态active, disabled, focus, pressed, selected, background,readonly, alternate, invalid
○4 function identify
<code object identify at 0x0000000002693660, file “……\lib\tkinter\ttk.py”, line 562>
def identify(self, x, y):
返回位于x、y位置的元素名称,如果该点不在任何元素中,则返回空字符串。X和y是相对于小部件的像素坐标。
○5 function instate
<code object instate at 0x00000000026936F0, file “……\lib\tkinter\ttk.py”, line 570>
def instate(self, statespec, callback=None, args, **kw):
测试小部件的状态。
如果callback未指定,如果小部件状态与statespec匹配则返回True,否则返回False。
如果指定了callback,那么如果小部件状态匹配statespec,它将被args, **kw调用。预计Statespec将是一个序列。
○6 function state
<code object state at 0x0000000002693780, file “……\lib\tkinter\ttk.py”, line 585>
def state(self, statespec=None):
修改或查询小部件状态。
如果statespec为None,则返回窗口小部件状态,否则根据statespec标志设置窗口小部件状态,
然后返回一个新的状态规范,指示哪些标志被更改。预计Statespec将是一个序列。
Button
15 type Button <class ‘tkinter.ttk.Button’>
1 str module tkinter.ttk
2 str doc
Ttk按钮小部件,显示文本标签和/或图像,并在按下时执行命令。
3 function init
<code object init at 0x00000000026938A0, file “……\lib\tkinter\ttk.py”, line 602>
用父主组件构造一个Ttk Button小部件。
标准选项:class, compound, cursor, image, state, style, takefocus, text, textvariable, underline, widthWIDGET-特有项:command, default, width
○4 function invoke
<code object invoke at 0x0000000002693930, file “……\lib\tkinter\ttk.py”, line 617>
def invoke(self):
调用与按钮关联的命令。
Checkbutton
16 type Checkbutton <class ‘tkinter.ttk.Checkbutton’>
1 str module tkinter.ttk
2 str doc
Ttk检查按钮小部件,要么在打开或关闭状态。
3 function init
<code object init at 0x0000000002693A50, file “……\lib\tkinter\ttk.py”, line 625>
用父主组件构造一个Ttk Checkbutton小部件。
Construct a Ttk Checkbutton widget with the parent master.
标准选项类,复合,游标,图像,状态,样式,取焦,文本,文本变量,下划线,宽度小部件特定选项:命令,offvalue, onvalue,变量标准选项:class, compound, cursor, image, state, style, takefocus, text, textvariable, underline, width小部件特定选项:command, offvalue, onvalue, variable
○4 function invoke
<code object invoke at 0x0000000002693AE0, file “……\lib\tkinter\ttk.py”, line 640>
def invoke(self):
在选定和取消选定的状态之间切换,并调用相关的命令。
如果小部件当前被选中,则将选项变量设置为offvalue选项并取消选择小部件;否则,将选项变量设置为 onvalue选项。返回相关命令的结果。
Entry
17 type Entry <class ‘tkinter.ttk.Entry’>
1 str module tkinter.ttk
2 str doc
Entry小部件显示一行文本字符串,并允许用户编辑该字符串。
3 function init
<code object init at 0x0000000002693C90, file “……\lib\tkinter\ttk.py”, line 655>
构造带有父主组件的Ttk Entry小部件。
标准选项:class, cursor, style, takefocus, xscrollcommand小部件特定选项:exportselection, invalidcommand, justify, show, state, textvariable, validate, validatecommand, width验证模式:none, key, focus, focusin, focusout, all
○4 function bbox
<code object bbox at 0x0000000002693D20, file “……\lib\tkinter\ttk.py”, line 674>
def bbox(self, index):
返回一个(x, y, width, height)的元组,用于描述index给出的字符的边界框。
○5 function identify
<code object identify at 0x0000000002693DB0, file “……\lib\tkinter\ttk.py”, line 680>
def identify(self, x, y):
返回位于x、y位置的元素名称,如果坐标在窗口外,则返回空字符串。
○6 function validate
<code object validate at 0x0000000002693E40, file “……\lib\tkinter\ttk.py”, line 686>
def validate(self):
强制重新验证,与validate选项指定的条件无关。如果验证失败返回False,如果验证成功返回True。设置或清除相应的无效状态。
Combobox
18 type Combobox <class ‘tkinter.ttk.Combobox’>
1 str module tkinter.ttk
2 str doc
组合框小部件将文本字段与弹出式下拉值列表组合在一起。
3 function init
<code object init at 0x0000000002698030, file “……\lib\tkinter\ttk.py”, line 697>
用父主组件构造一个组合框小部件。
标准选项:class, cursor, style, takefocus小部件特定选项:exportselection, justify, height, postcommand, state, textvariable, values, width
○4 function current
<code object current at 0x00000000026980C0, file “……\lib\tkinter\ttk.py”, line 712>
def current(self, newindex=None):
如果提供了 newindex,则将组合框值设置为值列表中newindex位置的元素。否则,返回值列表中当前值的索引,如果当前值未出现在列表中,则返回-1。
○5 function set
<code object set at 0x0000000002698150, file “……\lib\tkinter\ttk.py”, line 722>
def set(self, value):
将组合框的值设置为value。
Frame
19 type Frame <class ‘tkinter.ttk.Frame’>
1 str module tkinter.ttk
2 str doc
Ttk Frame小部件是一个容器,用于将其他小部件分组在一起。
3 function init
<code object init at 0x0000000002698270, file “……\lib\tkinter\ttk.py”, line 731>
构造一个父主Ttk框架。
标准选项:class, cursor, style, takefocus小部件特定选项:borderwidth, relief, padding, width, height
Label
20 type Label <class ‘tkinter.ttk.Label’>
1 str module tkinter.ttk
2 str doc
Ttk标签小部件显示文本标签和/或图像。
3 function init
<code object init at 0x0000000002698390, file “……\lib\tkinter\ttk.py”, line 748>
用父master构造一个Ttk Label。
标准选项:class, compound, cursor, image, style, takefocus, text, textvariable, underline, width小部件特定选项:anchor, background, font, foreground, justify, padding, relief, text, wraplengthtext: 指定显示在控件内的文本。textvariable: 指定一个变量名,其值将用于设置 text 参数。underline: 设置文本字符串中带下划线字符的索引(基于0)。下划线字符用于激活快捷键。image: 指定一个用于显示的图像。这是一个由1个或多个元素组成的列表。第一个元素是默认的图像名称。列表的其余部分是由"Style.map()"定义的“状态/值对”的序列,指定控件在某状态或状态组合时要采用的图像。列表中的所有图像应具备相同的尺寸。compound: 指定同时存在text和image参数时,应如何显示文本和对应的图片。合法的值包括:*text:只显示文本*image:只显示图片*top,bottom,left,right:分别显示图片的上,下,左,右的文本.*none:默认.如果设置显示图片,否则文本.width: 如果值大于零,指定文本标签留下多少空间,单位是字符数;如果值小于零,则指定最小宽度。如果等于零或未指定,则使用文本标签本身的宽度。
Labelframe
21 type Labelframe <class ‘tkinter.ttk.Labelframe’>
1 str module tkinter.ttk
2 str doc
Ttk Labelframe小部件是用于将其他小部件分组在一起的容器。它有一个可选标签,可以是纯文本字符串或另一个小部件。
3 function init
<code object init at 0x00000000026984B0, file “……\lib\tkinter\ttk.py”, line 769>
用父主构造一个Ttk标签帧。
标准选项:class, cursor, style, takefocus小部件特定选项:labelanchor, text, underline, padding, labelwidget, width,height
LabelFrame
22 type LabelFrame <class ‘tkinter.ttk.Labelframe’>
LabelFrame = Labelframe
Menubutton
23 type Menubutton <class ‘tkinter.ttk.Menubutton’>
1 str module tkinter.ttk
2 str doc
Ttk Menubutton小部件显示文本标签和/或图像,并在按下时显示菜单。
3 function init
<code object init at 0x00000000026985D0, file “……\lib\tkinter\ttk.py”, line 789>
构造一个父主Ttk Menubutton。
标准选项:class, compound, cursor, image, state, style, takefocus, text, textvariable, underline, width小部件特定选项:direction, menu
Notebook
24 type Notebook <class ‘tkinter.ttk.Notebook’>
1 str module tkinter.ttk
2 str doc
Ttk Notebook小部件管理窗口集合,每次只显示一个窗口。每个子窗口都与一个选项卡相关联,用户可以选择该选项卡来更改当前显示的窗口。
3 function init
<code object init at 0x0000000002698780, file “……\lib\tkinter\ttk.py”, line 809>
与父主一起构建一个Ttk笔记本。
标准选项:class, cursor, style, takefocus小部件特定选项:height, padding, widthTAB 选项:state, sticky, padding, text, image, compound, underlineTAB 标识符: (tab_id)在一些方法中找到的tab_id参数可能采取以下形式:* 0-tab数量 之间的一个整数* 子窗口的名字* 用位置指定 "@x,y" tab 出现的位置* "current" 当前选定的 tab* "end", 用于返回选项卡的数量(仅对方法index有效)
○4 function add
<code object add at 0x0000000002698810, file “……\lib\tkinter\ttk.py”, line 841>
def add(self, child, **kw):
向笔记本添加一个新选项卡。如果窗口当前由笔记本管理但隐藏,则它将恢复到以前的位置。
○5 function forget
<code object forget at 0x0000000002698930, file “……\lib\tkinter\ttk.py”, line 849>
def forget(self, tab_id):
删除由选项卡id指定的选项卡,取消关联窗口的映射和管理。
○6 function hide
<code object hide at 0x00000000026989C0, file “……\lib\tkinter\ttk.py”, line 855>
def hide(self, tab_id):
隐藏由标签id指定的标签。选项卡将不会显示,但相关的窗口仍然由笔记本管理,其配置将被记住。使用add命令可以恢复隐藏的选项卡。
○7 function identify
<code object identify at 0x0000000002698AE0, file “……\lib\tkinter\ttk.py”, line 864>
def identify(self, x, y):
返回tab元素在x、y位置的名称,如果没有则返回空字符串。
○8 function index
<code object index at 0x0000000002698B70, file “……\lib\tkinter\ttk.py”, line 870>
def index(self, tab_id):
返回由tab_id指定的制表符的数字索引,如果tab_id为字符串 “end” 则返回制表符总数。
○9 function insert
<code object insert at 0x0000000002698C00, file “……\lib\tkinter\ttk.py”, line 876>
def insert(self, pos, child, **kw):
在指定位置插入窗格。Pos是字符串结尾、整数索引或托管子节点的名称。如果子节点已由笔记本管理,则将其移动到指定位置。
○10 function select
<code object select at 0x0000000002698C90, file “……\lib\tkinter\ttk.py”, line 885>
def select(self, tab_id=None):
选择指定的选项卡。相关的子窗口将被显示,之前选择的窗口(如果不同)将被取消映射。如果省略选项卡id,则返回当前选定窗格的小部件名称。
○11 function tab
<code object tab at 0x0000000002698D20, file “……\lib\tkinter\ttk.py”, line 895>
def tab(self, tab_id, option=None, **kw):
查询或修改指定标签id的选项。如果没有给出kw,则返回制表符选项值的dict。如果指定了option,则返回该选项的值。否则,将选项设置为相应的值。
○12 function tabs
<code object tabs at 0x0000000002698DB0, file “……\lib\tkinter\ttk.py”, line 906>
def tabs(self):
返回笔记本管理的窗口列表。
○13 function enable_traversal
<code object enable_traversal at 0x0000000002698E40, file “……\lib\tkinter\ttk.py”, line 911>
def enable_traversal(self):
为包含此笔记本的顶层窗口启用键盘遍历。
这将扩展包含该笔记本的顶层窗口的绑定,如下所示:
Control-Tab:选择当前选中的选项卡后面的选项卡
Shift-Control-Tab:选择当前选中的选项卡前面的选项卡
Alt-K:其中K是任何选项卡的助记符(带下划线)字符,将选择该选项卡。
一个顶层中的多个笔记本可以用于遍历,包括嵌套笔记本。但是,只有当所有窗格都是笔记本的直接子窗格时,笔记本遍历才能正常工作。
Panedwindow
25 type Panedwindow <class ‘tkinter.ttk.Panedwindow’>
1 str module tkinter.ttk
2 str doc
Ttk Panedwindow小部件显示许多子窗口,垂直或水平堆叠。
3 function init
<code object init at 0x0000000002698F60, file “……\lib\tkinter\ttk.py”, line 941>
构造一个父主的Ttk Panedwindow。
标准选项:class, cursor, style, takefocus小部件特定选项:orient, width, heightPANE 选项:weight
○4 function forget
<code object remove at 0x000000000265BED0, file “……\lib\tkinter_init_.py”, line 3825>
def remove(self, child):
从窗格窗口中删除包含子元素的窗格将会忘记子元素的所有几何管理选项。
○5 function insert
<code object insert at 0x000000000269D030, file “……\lib\tkinter\ttk.py”, line 962>
def insert(self, pos, child, **kw):
在指定位置插入窗格。Pos是字符串的结尾,整数索引,或者子节点的名称。如果子节点已由窗格窗口管理,则将其移动到指定位置。
○6 function pane
<code object pane at 0x000000000269D0C0, file “……\lib\tkinter\ttk.py”, line 971>
def pane(self, pane, option=None, **kw):
查询或修改指定窗格的选项。窗格是一个整数索引或托管子窗口的名称。
如果没有给出kw,则返回窗格选项值的dict。如果指定了option,则返回该选项的值。否则,将选项设置为相应的值。
○7 function sashpos
<code object sashpos at 0x000000000269D150, file “……\lib\tkinter\ttk.py”, line 983>
def sashpos(self, index, newpos=None):
如果指定newpos,则设置窗框号索引的位置。可以调整相邻窗框的位置,以确保位置单调增加。
窗框位置进一步被限制在0到小部件的总大小之间。返回窗框号索引的新位置。
PanedWindow
26 type PanedWindow <class ‘tkinter.ttk.Panedwindow’>
PanedWindow = Panedwindow
Progressbar
27 type Progressbar <class ‘tkinter.ttk.Progressbar’>
1 str module tkinter.ttk
2 str doc
Ttk进度条小部件显示长时间运行的操作的状态。
它们可以在两种模式下运行:确定模式显示相对于要完成的工作总量的完成量,而不确定模式提供动画显示,让用户知道正在发生一些事情。
3 function init
<code object init at 0x000000000269D300, file “……\lib\tkinter\ttk.py”, line 1003>
构造一个父主Ttk进度条。
标准选项:class, cursor, style, takefocus小部件特定选项:orient, length, mode, maximum, value, variable, phase阶段
○4 function start
<code object start at 0x000000000269D390, file “……\lib\tkinter\ttk.py”, line 1017>
def start(self, interval=None):
开始自动递增模式:调度一个循环的定时器事件,该事件每隔几毫秒调用方法step。如果省略,间隔默认为50毫秒(20步/秒)。
○5 function step
<code object step at 0x000000000269D4B0, file “……\lib\tkinter\ttk.py”, line 1025>
def step(self, amount=None):
将值选项按数量递增。如果省略,数量默认为1.0。
○6 function stop
<code object stop at 0x000000000269D5D0, file “……\lib\tkinter\ttk.py”, line 1032>
def stop(self):
停止自增模式:取消任何由start启动的循环计时器事件。
Radiobutton
28 type Radiobutton <class ‘tkinter.ttk.Radiobutton’>
1 str module tkinter.ttk
2 str doc
Ttk单选按钮小部件以组形式使用,以显示或更改一组互斥选项。
3 function init
<code object init at 0x000000000269D6F0, file “……\lib\tkinter\ttk.py”, line 1042>
构造一个父主Ttk单选按钮。
标准选项:class, compound, cursor, image, state, style, takefocus, text, textvariable, underline, width小部件特定选项:command, value, variable
○4 function invoke
<code object invoke at 0x000000000269D780, file “……\lib\tkinter\ttk.py”, line 1057>
def invoke(self):
将选项变量设置为选项值,选择小部件,并调用相关命令。返回命令的结果,如果未指定命令,则返回空字符串。
Scale
29 type Scale <class ‘tkinter.ttk.Scale’>
1 str module tkinter.ttk
2 str doc
Ttk Scale小部件通常用于控制在一定范围内统一变化的链接变量的数值。
3 function init
<code object init at 0x000000000269D930, file “……\lib\tkinter\ttk.py”, line 1070>
与父主一起构建Ttk量表。
标准选项:class, cursor, style, takefocus小部件特定选项:command, from, length, orient, to, value, variable
○4 function configure
<code object configure at 0x000000000269D9C0, file “……\lib\tkinter\ttk.py”, line 1084>
def configure(self, cnf=None, **kw):
修改或查询规模选项。为"from", “from_” 或 “to”;选项设置一个值会生成一个 <> 事件。
○5 function get
<code object get at 0x000000000269DA50, file “……\lib\tkinter\ttk.py”, line 1097>
def get(self, x=None, y=None):
获取值选项的当前值,或者与指定的坐标x, y对应的值。X和y是相对于缩放小部件原点的像素坐标。
Scrollbar
30 type Scrollbar <class ‘tkinter.ttk.Scrollbar’>
1 str module tkinter.ttk
2 str doc
Ttk滚动条控制可滚动小部件的视口。
3 function init
<code object init at 0x000000000269DB70, file “……\lib\tkinter\ttk.py”, line 1109>
构造一个父主Ttk滚动条。
标准选项:class, cursor, style, takefocus小部件特定选项:command, orient
Separator
31 type Separator <class ‘tkinter.ttk.Separator’>
1 str module tkinter.ttk
2 str doc
Ttk分隔符小部件显示水平或垂直分隔符条。
3 function init
<code object init at 0x000000000269DC90, file “……\lib\tkinter\ttk.py”, line 1127>
构造一个父主的Ttk分隔符。
标准选项:class, cursor, style, takefocus小部件特定选项:orient
Sizegrip
32 type Sizegrip <class ‘tkinter.ttk.Sizegrip’>
1 str module tkinter.ttk
2 str doc
Ttk Sizegrip允许用户通过按压和拖动手柄来调整包含的顶层窗口的大小。
3 function init
<code object init at 0x000000000269DDB0, file “……\lib\tkinter\ttk.py”, line 1145>
用父master构造一个Ttk Sizegrip。
标准选项:class, cursor, state, style, takefocus
Spinbox
33 type Spinbox <class ‘tkinter.ttk.Spinbox’>
1 str module tkinter.ttk
2 str doc
Ttk Spinbox是一个带有递增和递减箭头的条目。它通常用于数字输入或从字符串值列表中进行选择。
3 function init
<code object init at 0x000000000269DED0, file “……\lib\tkinter\ttk.py”, line 1162>
用父主组件构造一个Ttk Spinbox小部件。
标准选项:class, cursor, style, takefocus, validate, validatecommand, xscrollcommand, invalidcommand小部件特定选项:to, from_, increment, values, wrap, format, command
○4 function set
<code object set at 0x000000000269DF60, file “……\lib\tkinter\ttk.py”, line 1177>
def set(self, value):
将Spinbox的值设置为value。
Treeview
34 type Treeview <class ‘tkinter.ttk.Treeview’>
1 str module tkinter.ttk
2 str doc
Ttk Treeview小部件显示项的层次集合。
每个项目都有一个文本标签、一个可选的图像和一个可选的数据值列表。数据值显示在树标签后的连续列中。
3 function init
<code object init at 0x00000000026A30C0, file “……\lib\tkinter\ttk.py”, line 1189>
构造一个父主Ttk树视图。
标准选项:class, cursor, style, takefocus, xscrollcommand, yscrollcommand小部件特定选项:columns, displaycolumns, height, padding, selectmode, showITEM 选项:text, image, values, open, tagsTAG 选项:foreground, background, font, image
○4 function bbox
<code object bbox at 0x00000000026A3150, file “……\lib\tkinter\ttk.py”, line 1212>
def bbox(self, item, column=None):
返回指定项的边界框(相对于树视图小部件的窗口),格式为x y宽-高。如果指定了列,则返回该单元格的包围框。
如果项目不可见(即,如果它是关闭项目的后代或滚动到屏幕外),则返回空字符串。
○5 function get_children
<code object get_children at 0x00000000026A31E0, file “……\lib\tkinter\ttk.py”, line 1222>
def get_children(self, item=None):
返回属于item的子元组。如果未指定item,则返回根子项。
○6 function set_children
<code object set_children at 0x00000000026A3270, file “……\lib\tkinter\ttk.py”, line 1230>
def set_children(self, item, *newchildren):
用newchildren替换item的子元素。条目中出现的子条目在新条目中不出现,从树中分离出来。newchildren中的item不能是item的祖先。
○7 function column
<code object column at 0x00000000026A3300, file “……\lib\tkinter\ttk.py”, line 1239>
def column(self, column, option=None, **kw):
查询或修改指定列的选项。如果没有给出kw,则返回列选项值的dict。如果指定了option,则返回该选项的值。否则,将选项设置为相应的值。
○8 function delete
<code object delete at 0x00000000026A3420, file “……\lib\tkinter\ttk.py”, line 1250>
def delete(self, *items):
删除所有指定项及其所有子项。根项不能被删除。
○9 function detach
<code object detach at 0x00000000026A34B0, file “……\lib\tkinter\ttk.py”, line 1256>
def detach(self, *items):
从树中断开所有指定项的链接。项目及其所有后代仍然存在,并且可能被重新插入到树中的另一个点,但不会显示出来。根项目不能被分离。
○10 function exists
<code object exists at 0x00000000026A35D0, file “……\lib\tkinter\ttk.py”, line 1265>
def exists(self, item):
如果指定的项存在于树中,则返回True,否则返回False。
○11 function focus
<code object focus at 0x00000000026A3660, file “……\lib\tkinter\ttk.py”, line 1271>
def focus(self, item=None):
如果指定了item,则将焦点项设置为item。否则,返回当前焦点项,或者返回 ‘’,“如果没有”。
○12 function heading
<code object heading at 0x00000000026A36F0, file “……\lib\tkinter\ttk.py”, line 1277>
def heading(self, column, option=None, **kw):
查询或修改指定列的标题选项。如果没有给出kw,则返回标题选项值的dict。如果指定了option,则返回该选项的值。否则,将选项设置为相应的值。
有效的选项/值包括:
text: text列标题中显示的文本
image: image_name列标题右侧显示的图像
anchor: anchor标题文本的对齐方式。
一个标准的Tk锚值命令:callback当按下标题标签时调用的回调。要配置树列标题,调用 column = “#0”
○13 function identify
<code object identify at 0x00000000026A3780, file “……\lib\tkinter\ttk.py”, line 1309>
def identify(self, component, x, y):
返回x和y给出的点下的指定组件的描述,如果该位置没有该组件,则返回空字符串。
○14 function identify_row
<code object identify_row at 0x00000000026A3810, file “……\lib\tkinter\ttk.py”, line 1316>
def identify_row(self, y):
返回y位置的项目ID。
○15 function identify_column
<code object identify_column at 0x00000000026A38A0, file “……\lib\tkinter\ttk.py”, line 1321>
def identify_column(self, x):
返回位置x的单元格的数据列标识符。树列的 ID 为 #0。
○16 function identify_region
<code object identify_region at 0x00000000026A3930, file “……\lib\tkinter\ttk.py”, line 1328>
def identify_region(self, x, y):
返回其中之一:
heading:树标题区域。
separator:两列标题之间的空格;
tree:树的区域。
cell:数据单元。
* Availability可用性:Tk 8.6
○17 function identify_element
<code object identify_element at 0x00000000026A39C0, file “……\lib\tkinter\ttk.py”, line 1340>
def identify_element(self, x, y):
返回位于x, y位置的元素
* Availability: Tk 8.6
○18 function index
<code object index at 0x00000000026A3A50, file “……\lib\tkinter\ttk.py”, line 1347>
def index(self, item):
返回item在其父项的子列表中的整数索引。
○19 function insert
<code object insert at 0x00000000026A3AE0, file “……\lib\tkinter\ttk.py”, line 1353>
def insert(self, parent, index, iid=None, **kw):
创建一个新项并返回新创建项的项标识符。
parent是父项的项ID,或者创建新的顶级项的空字符串。
Index是一个整数,或者值的末尾,指定在父级的子级列表中插入新项的位置。
如果index小于或等于0,则新节点插入到开头,如果index大于或等于当前子节点的数量,则插入到结尾。
如果指定了iid,则用作项目标识符,iid必须在树中不存在。否则,将生成一个新的唯一标识符。
○20 function item
<code object item at 0x00000000026A3B70, file “……\lib\tkinter\ttk.py”, line 1376>
def item(self, item, option=None, **kw):
查询或修改指定项目的选项。如果没有给出选项,则返回包含该项选项/值的dict。
如果指定了option,则返回该选项的值。否则,将选项设置为kw给出的相应值。
○21 function move
<code object move at 0x00000000026A3C00, file “……\lib\tkinter\ttk.py”, line 1388>
def move(self, item, parent, index):
将项目移动到父元素列表中的位置索引。将一个项目移到它的一个后代下是非法的。
如果index小于或等于0,则item被移动到开头,如果大于或等于子项的数量,则被移动到结尾。如果项目被分离,它是重新连接。
○22 function reattach
<code object move at 0x00000000026A3C00, file “……\lib\tkinter\ttk.py”, line 1388>
def move(self, item, parent, index):
将项目移动到父元素列表中的位置索引。将一个项目移到它的一个后代下是非法的。
如果index小于或等于0,则item被移动到开头,如果大于或等于子项的数量,则被移动到结尾。如果项目被分离,它是重新连接。
○23 function next
<code object next at 0x00000000026A3C90, file “……\lib\tkinter\ttk.py”, line 1400>
def next(self, item):
返回项的下一个兄弟的标识符,或者返回 ‘’, 如果项是其父的最后一个子”。
○24 function parent
<code object parent at 0x00000000026A3D20, file “……\lib\tkinter\ttk.py”, line 1406>
def parent(self, item):
返回项的父项的ID,或者返回 ‘’, 如果项位于层次结构的顶层”。
○25 function prev
<code object prev at 0x00000000026A3DB0, file “……\lib\tkinter\ttk.py”, line 1412>
def prev(self, item):
返回项的上一个兄弟的标识符,或者返回 ‘’, 如果项是其父的第一个子”。
○26 function see
<code object see at 0x00000000026A3E40, file “……\lib\tkinter\ttk.py”, line 1418>
def see(self, item):
确保该项目是可见的。将所有项目的祖先打开选项设置为True,并在必要时滚动小部件,以便该项目位于树的可见部分中。
○27 function selection
<code object selection at 0x00000000026A3F60, file “……\lib\tkinter\ttk.py”, line 1427>
def selection(self, selop=_sentinel, items=None):
返回所选项的元组。
○28 function selection_set
<code object selection_set at 0x00000000026A70C0, file “……\lib\tkinter\ttk.py”, line 1456>
def selection_set(self, *items):
指定的项目成为新的选择。
○29 function selection_add
<code object selection_add at 0x00000000026A7150, file “……\lib\tkinter\ttk.py”, line 1461>
def selection_add(self, *items):
将所有指定的项添加到所选内容中。
○30 function selection_remove
<code object selection_remove at 0x00000000026A71E0, file “……\lib\tkinter\ttk.py”, line 1466>
def selection_remove(self, *items):
从选定项中删除所有指定项。
○31 function selection_toggle
<code object selection_toggle at 0x00000000026A7270, file “……\lib\tkinter\ttk.py”, line 1471>
def selection_toggle(self, *items):
切换每个指定项的选择状态。
○32 function set
<code object set at 0x00000000026A7300, file “……\lib\tkinter\ttk.py”, line 1476>
def set(self, item, column=None, value=None):
查询或设置给定项的值。使用一个参数,返回指定项的列/值对字典。使用两个参数,返回指定列的当前值。通过三个参数,将给定项中给定列的值设置为指定值。
○33 function tag_bind
<code object tag_bind at 0x00000000026A7390, file “……\lib\tkinter\ttk.py”, line 1491>
def tag_bind(self, tagname, sequence=None, callback=None):
将给定事件序列的回调绑定到标记tagname。将事件传递给项时,将调用该项的每个标签选项的回调。
○34 function tag_configure
<code object tag_configure at 0x00000000026A7420, file “……\lib\tkinter\ttk.py”, line 1498>
def tag_configure(self, tagname, option=None, **kw):
查询或修改指定标记名的选项。如果没有给出kw,则返回tagname选项设置的dict。
如果指定了option,则返回指定标记名的该选项的值。否则,将选项设置为给定标记名的对应值。
○35 function tag_has
<code object tag_has at 0x00000000026A74B0, file “……\lib\tkinter\ttk.py”, line 1511>
def tag_has(self, tagname, item=None):
如果指定了item,则返回1或0,具体取决于指定的项是否具有给定的标记名。否则,返回具有指定标记的所有项的列表。
* Availability可用性:Tk 8.6
LabeledScale
35 type LabeledScale <class 'tkinter.ttk.LabeledScale'>
1 str module tkinter.ttk
2 str doc
Ttk Scale小部件,其中Ttk Label小部件指示其当前值。
Ttk Scale可以通过 instance.scale 访问。Ttk Label可以通过instance.label访问。
3 function init
<code object init at 0x00000000026A75D0, file “……\lib\tkinter\ttk.py”, line 1534>
构造带有父master的水平LabeledScale,这是一个与Ttk Scale小部件及其范围相关联的变量。
如果未指定variable,则创建 tkinter.IntVar。
小部件特定选项:
compound组合: ‘top’ or ‘bottom’ 指定如何相对于比例显示标签。默认为’top’。
○4 function destroy
<code object destroy at 0x00000000026A7660, file “……\lib\tkinter\ttk.py”, line 1569>
def destroy(self):
销毁这个小部件和可能的关联变量。
5 property value
<property object at 0x00000000026B3638>
OptionMenu
36 type OptionMenu <class 'tkinter.ttk.OptionMenu'>
1 str module tkinter.ttk
2 str doc
特定历史时期的OptionMenu,基于tkinter的OptionMenu,允许用户从菜单中选择一个值。
3 function init
<code object init at 0x00000000026A7AE0, file “……\lib\tkinter\ttk.py”, line 1624>
def init(self, master, variable, default=None, values, **kwargs):
构造一个主题化的OptionMenu小部件,master作为父部件,资源textvariable设置为variable,
初始选择的值由默认参数指定,菜单值由values和其他关键字给出。
小部件特定选项:
style: stylename
Menubutton style.
direction: ‘above’, ‘below’, ‘left’, ‘right’, or ‘flush’
Menubutton direction.
command: callback
在选择一个项目后将被调用的回调。
4 function getitem
<function OptionMenu.getitem at 0x00000000026B8318>
○5 function set_menu
<code object set_menu at 0x00000000026A7C90, file “……\lib\tkinter\ttk.py”, line 1660>
def set_menu(self, default=None, values):
构建一个带有values和可选默认值default的新单选按钮菜单。
○6 function destroy
<code object destroy at 0x00000000026A7D20, file “……\lib\tkinter\ttk.py”, line 1674>
def destroy(self):
销毁这个小部件及其相关变量。
三、函数
○37 function tclobjs_to_py
<code object tclobjs_to_py at 0x0000000002692C00, file “……\lib\tkinter\ttk.py”, line 337>
def tclobjs_to_py(adict):
返回adict,其值从Tcl对象转换为Python对象。
○38 function setup_master
<code object setup_master at 0x0000000002692C90, file “……\lib\tkinter\ttk.py”, line 345>
def setup_master(master=None):
如果master不是None,则返回本身。
如果master为None,则返回默认的master,否则创建并返回一个新的master。
如果不允许使用默认根且master为None,则会引发RuntimeError。
the End of tkinter.ttk
tkinter.ttk 资料整理+笔记(大全)相关推荐
- 一图看懂 pytz 模块:现代以及历史版本的世界时区定义数据库,资料整理+笔记(大全)
本文由 大侠(AhcaoZhu)原创,转载请声明. 链接: https://blog.csdn.net/Ahcao2008 一图看懂 pytz 模块:现代以及历史版本的世界时区定义,将时区数据库引入 ...
- 一图看懂 zipp 模块:ZipFile 的一些兼容子类和补充接口,资料整理+笔记(大全)
本文由 大侠(AhcaoZhu)原创,转载请声明. 链接: https://blog.csdn.net/Ahcao2008 一图看懂 zipp 模块:ZipFile 的一些兼容子类和补充接口,资料整理 ...
- 一图看懂 aiohttp 模块:基于 asyncio 的异步HTTP网络库, 资料整理+笔记(大全)
本文由 大侠(AhcaoZhu)原创,转载请声明. 链接: https://blog.csdn.net/Ahcao2008 一图看懂 aiohttp 模块:基于 asyncio 的异步HTTP网络库, ...
- 一图看懂 docx 读取、查询、修改 Ms Word docx 文件, 资料整理+笔记(大全)
本文由 大侠(AhcaoZhu)原创,转载请声明. 链接: https://blog.csdn.net/Ahcao2008 一图看懂 docx 读取.查询.修改 Ms Word docx 文件, 资料 ...
- 一图看懂 toml 模块:用于解析和创建TOML(Tom‘s Obvious, Minimal Language)的Python库, 资料整理+笔记(大全)
本文由 大侠(AhcaoZhu)原创,转载请声明. 链接: https://blog.csdn.net/Ahcao2008 @[TOC](一图看懂 toml 模块:用于解析和创建TOML(Tom's ...
- 一图看懂 tomli 模块:一个 TOML解析器、使用 mformat -toc 生成的目录,资料整理+笔记(大全)
本文由 大侠(AhcaoZhu)原创,转载请声明. 链接: https://blog.csdn.net/Ahcao2008 一图看懂 tomli 模块:一个 TOML解析器.使用 mformat -t ...
- 兼容iOS 10 资料整理笔记
1.Notification(通知) 自从Notification被引入之后,苹果就不断的更新优化,但这些更新优化只是小打小闹,直至现在iOS 10开始真正的进行大改重构,这让开发者也体会到UserN ...
- 关于新版本,iOS10的相关内容,兼容iOS 10 资料整理笔记
1.Notification(通知) 自从Notification被引入之后,苹果就不断的更新优化,但这些更新优化只是小打小闹,直至现在iOS 10开始真正的进行大改重构,这让开发者也体会到UserN ...
- 09_分类算法--k近邻算法(KNN)、案例、欧氏距离、k-近邻算法API、KNeighborsClassifier、及其里面的案例(网络资料+学习资料整理笔记)
1 分类算法–k近邻算法(KNN) 定义:如果一个样本在特征空间中**k个最相似(即特征空间中最邻近)**的样本中的大多数属于某一个类别,则该样本也属于这个类别,则该样本也属于这个类别. k-近邻算法 ...
最新文章
- 【Codeforces】1080C Masha and two friends (棋盘染色)
- [蓝桥杯][2018年第九届真题]日志统计(树状数组)
- Android之AndroidManifest.xml文件解析和权限集合
- 基于JAVA+SpringMVC+MYSQL的球队管理系统
- pandas.Series.asfreq
- java时间日期类(Date、DateFormat、Calendar)学习
- SEO工具,站长必备
- 如何使用PowerShell批量删除注册表项
- 推荐系统给电影评分排名的方法
- Unity Bounds的理解
- 概率论与数理统计期末考试复习总结
- 机器学习项目(五) 电影推荐系统(二)
- tesseract-ocr
- CDR插件开发之Addon插件007 - Addon插件简介和案例演示
- 4.4 Kali与windows xp之间搭建TFTP服务
- Photoshop如何改变背景底色并调整照片尺寸和图像大小
- 均方距离计算公式_Excel2013中通过公式计算方差与均方差来反映数据的偏移程度...
- 【Simulink】数字控制振荡器 NCO ( N umerically CONtrolled Oscillator )
- 你不知道的十个 JS 小技巧
- Codeforces Problem-1579A Casimir‘s String Solitaire