| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1 | :mod:`tkinter.ttk` --- Tk themed widgets | 
 | 2 | ======================================== | 
 | 3 |  | 
 | 4 | .. module:: tkinter.ttk | 
 | 5 |    :synopsis: Tk themed widget set | 
 | 6 | .. sectionauthor:: Guilherme Polo <ggpolo@gmail.com> | 
 | 7 |  | 
 | 8 |  | 
 | 9 | .. index:: single: ttk | 
 | 10 |  | 
 | 11 | The :mod:`tkinter.ttk` module provides access to the Tk themed widget set, | 
| Raymond Hettinger | 238018c | 2009-04-08 08:23:44 +0000 | [diff] [blame] | 12 | introduced in Tk 8.5. If Python has not been compiled against Tk 8.5, this | 
 | 13 | module can still be accessed if *Tile* has been installed.  The former | 
 | 14 | method using Tk 8.5 provides additional benefits including anti-aliased font | 
 | 15 | rendering under X11 and window transparency (requiring a composition | 
 | 16 | window manager on X11). | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 17 |  | 
| Raymond Hettinger | 238018c | 2009-04-08 08:23:44 +0000 | [diff] [blame] | 18 | The basic idea for :mod:`tkinter.ttk` is to separate, to the extent possible, | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 19 | the code implementing a widget's behavior from the code implementing its | 
 | 20 | appearance. | 
 | 21 |  | 
 | 22 |  | 
 | 23 | .. seealso:: | 
 | 24 |  | 
 | 25 |    `Tk Widget Styling Support <http://www.tcl.tk/cgi-bin/tct/tip/48>`_ | 
| Raymond Hettinger | 238018c | 2009-04-08 08:23:44 +0000 | [diff] [blame] | 26 |       A document introducing theming support for Tk | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 27 |  | 
 | 28 |  | 
 | 29 | Using Ttk | 
 | 30 | --------- | 
 | 31 |  | 
| Raymond Hettinger | 238018c | 2009-04-08 08:23:44 +0000 | [diff] [blame] | 32 | To start using Ttk, import its module:: | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 33 |  | 
 | 34 |    from tkinter import ttk | 
 | 35 |  | 
| Raymond Hettinger | 238018c | 2009-04-08 08:23:44 +0000 | [diff] [blame] | 36 | To override the basic Tk widgets, the import should follow the Tk import:: | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 37 |  | 
 | 38 |    from tkinter import * | 
 | 39 |    from tkinter.ttk import * | 
 | 40 |  | 
| Raymond Hettinger | 238018c | 2009-04-08 08:23:44 +0000 | [diff] [blame] | 41 | That code causes several :mod:`tkinter.ttk` widgets (:class:`Button`, | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 42 | :class:`Checkbutton`, :class:`Entry`, :class:`Frame`, :class:`Label`, | 
 | 43 | :class:`LabelFrame`, :class:`Menubutton`, :class:`PanedWindow`, | 
| Raymond Hettinger | 238018c | 2009-04-08 08:23:44 +0000 | [diff] [blame] | 44 | :class:`Radiobutton`, :class:`Scale` and :class:`Scrollbar`) to | 
 | 45 | automatically replace the Tk widgets. | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 46 |  | 
| Raymond Hettinger | 238018c | 2009-04-08 08:23:44 +0000 | [diff] [blame] | 47 | This has the direct benefit of using the new widgets which gives a better | 
 | 48 | look and feel across platforms; however, the replacement widgets are not | 
 | 49 | completely compatible. The main difference is that widget options such as | 
 | 50 | "fg", "bg" and others related to widget styling are no | 
 | 51 | longer present in Ttk widgets.  Instead, use  the :class:`ttk.Style` class | 
 | 52 | for improved styling effects. | 
 | 53 |  | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 54 |  | 
 | 55 | .. seealso:: | 
 | 56 |  | 
| Raymond Hettinger | 238018c | 2009-04-08 08:23:44 +0000 | [diff] [blame] | 57 |    `Converting existing applications to use Tile widgets <http://tktable.sourceforge.net/tile/doc/converting.txt>`_ | 
 | 58 |      A monograph (using Tcl terminology) about differences typically | 
 | 59 |      encountered when moving applications to use the new widgets. | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 60 |  | 
 | 61 |  | 
 | 62 | Ttk Widgets | 
 | 63 | ----------- | 
 | 64 |  | 
| Raymond Hettinger | 238018c | 2009-04-08 08:23:44 +0000 | [diff] [blame] | 65 | Ttk comes with 17 widgets, eleven of which already existed in tkinter: | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 66 | :class:`Button`, :class:`Checkbutton`, :class:`Entry`, :class:`Frame`, | 
 | 67 | :class:`Label`, :class:`LabelFrame`, :class:`Menubutton`, :class:`PanedWindow`, | 
| Raymond Hettinger | 238018c | 2009-04-08 08:23:44 +0000 | [diff] [blame] | 68 | :class:`Radiobutton`, :class:`Scale` and :class:`Scrollbar`. The other six are | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 69 | new: :class:`Combobox`, :class:`Notebook`, :class:`Progressbar`, | 
 | 70 | :class:`Separator`, :class:`Sizegrip` and :class:`Treeview`. And all them are | 
 | 71 | subclasses of :class:`Widget`. | 
 | 72 |  | 
| Raymond Hettinger | 238018c | 2009-04-08 08:23:44 +0000 | [diff] [blame] | 73 | Using the Ttk widgets gives the application an improved look and feel. | 
 | 74 | As discussed above, there are differences in how the styling is coded. | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 75 |  | 
 | 76 | Tk code:: | 
 | 77 |  | 
 | 78 |    l1 = tkinter.Label(text="Test", fg="black", bg="white") | 
 | 79 |    l2 = tkinter.Label(text="Test", fg="black", bg="white") | 
 | 80 |  | 
 | 81 |  | 
 | 82 | Ttk code:: | 
 | 83 |  | 
 | 84 |    style = ttk.Style() | 
 | 85 |    style.configure("BW.TLabel", foreground="black", background="white") | 
 | 86 |  | 
 | 87 |    l1 = ttk.Label(text="Test", style="BW.TLabel") | 
 | 88 |    l2 = ttk.Label(text="Test", style="BW.TLabel") | 
 | 89 |  | 
| Raymond Hettinger | 238018c | 2009-04-08 08:23:44 +0000 | [diff] [blame] | 90 | For more information about TtkStyling_, see the :class:`Style` class | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 91 | documentation. | 
 | 92 |  | 
 | 93 | Widget | 
 | 94 | ------ | 
 | 95 |  | 
 | 96 | :class:`ttk.Widget` defines standard options and methods supported by Tk | 
 | 97 | themed widgets and is not supposed to be directly instantiated. | 
 | 98 |  | 
 | 99 |  | 
 | 100 | Standard Options | 
 | 101 | ^^^^^^^^^^^^^^^^ | 
 | 102 |  | 
 | 103 | All the :mod:`ttk` Widgets accepts the following options: | 
 | 104 |  | 
| Georg Brandl | 44ea77b | 2013-03-28 13:28:44 +0100 | [diff] [blame] | 105 |    .. tabularcolumns:: |l|L| | 
 | 106 |  | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 107 |    +-----------+--------------------------------------------------------------+ | 
 | 108 |    | Option    | Description                                                  | | 
 | 109 |    +===========+==============================================================+ | 
 | 110 |    | class     | Specifies the window class. The class is used when querying  | | 
 | 111 |    |           | the option database for the window's other options, to       | | 
 | 112 |    |           | determine the default bindtags for the window, and to select | | 
 | 113 |    |           | the widget's default layout and style. This is a read-only   | | 
 | 114 |    |           | which may only be specified when the window is created       | | 
 | 115 |    +-----------+--------------------------------------------------------------+ | 
 | 116 |    | cursor    | Specifies the mouse cursor to be used for the widget. If set | | 
 | 117 |    |           | to the empty string (the default), the cursor is inherited   | | 
 | 118 |    |           | for the parent widget.                                       | | 
 | 119 |    +-----------+--------------------------------------------------------------+ | 
 | 120 |    | takefocus | Determines whether the window accepts the focus during       | | 
| Ezio Melotti | 1a263ad | 2010-03-14 09:51:37 +0000 | [diff] [blame] | 121 |    |           | keyboard traversal. 0, 1 or an empty string is returned.     | | 
 | 122 |    |           | If 0 is returned, it means that the window should be skipped | | 
 | 123 |    |           | entirely during keyboard traversal. If 1, it means that the  | | 
 | 124 |    |           | window should receive the input focus as long as it is       | | 
 | 125 |    |           | viewable. And an empty string means that the traversal       | | 
 | 126 |    |           | scripts make the decision about whether or not to focus      | | 
 | 127 |    |           | on the window.                                               | | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 128 |    +-----------+--------------------------------------------------------------+ | 
 | 129 |    | style     | May be used to specify a custom widget style.                | | 
 | 130 |    +-----------+--------------------------------------------------------------+ | 
 | 131 |  | 
 | 132 |  | 
 | 133 | Scrollable Widget Options | 
 | 134 | ^^^^^^^^^^^^^^^^^^^^^^^^^ | 
 | 135 |  | 
 | 136 | The following options are supported by widgets that are controlled by a | 
 | 137 | scrollbar. | 
 | 138 |  | 
| Georg Brandl | 44ea77b | 2013-03-28 13:28:44 +0100 | [diff] [blame] | 139 |    .. tabularcolumns:: |l|L| | 
 | 140 |  | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 141 |    +----------------+---------------------------------------------------------+ | 
| Georg Brandl | 44ea77b | 2013-03-28 13:28:44 +0100 | [diff] [blame] | 142 |    | Option         | Description                                             | | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 143 |    +================+=========================================================+ | 
| Georg Brandl | ae2dbe2 | 2009-03-13 19:04:40 +0000 | [diff] [blame] | 144 |    | xscrollcommand | Used to communicate with horizontal scrollbars.         | | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 145 |    |                |                                                         | | 
 | 146 |    |                | When the view in the widget's window change, the widget | | 
 | 147 |    |                | will generate a Tcl command based on the scrollcommand. | | 
 | 148 |    |                |                                                         | | 
 | 149 |    |                | Usually this option consists of the method              | | 
 | 150 |    |                | :meth:`Scrollbar.set` of some scrollbar. This will cause| | 
 | 151 |    |                | the scrollbar to be updated whenever the view in the    | | 
 | 152 |    |                | window changes.                                         | | 
 | 153 |    +----------------+---------------------------------------------------------+ | 
| Georg Brandl | ae2dbe2 | 2009-03-13 19:04:40 +0000 | [diff] [blame] | 154 |    | yscrollcommand | Used to communicate with vertical scrollbars.           | | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 155 |    |                | For some more information, see above.                   | | 
 | 156 |    +----------------+---------------------------------------------------------+ | 
 | 157 |  | 
 | 158 |  | 
 | 159 | Label Options | 
 | 160 | ^^^^^^^^^^^^^ | 
 | 161 |  | 
 | 162 | The following options are supported by labels, buttons and other button-like | 
 | 163 | widgets. | 
 | 164 |  | 
| Georg Brandl | 44ea77b | 2013-03-28 13:28:44 +0100 | [diff] [blame] | 165 |    .. tabularcolumns:: |l|p{0.7\linewidth}| | 
| Georg Brandl | 2c86004 | 2009-06-16 19:24:38 +0000 | [diff] [blame] | 166 |  | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 167 |    +--------------+-----------------------------------------------------------+ | 
| Georg Brandl | 44ea77b | 2013-03-28 13:28:44 +0100 | [diff] [blame] | 168 |    | Option       | Description                                               | | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 169 |    +==============+===========================================================+ | 
 | 170 |    | text         | Specifies a text string to be displayed inside the widget.| | 
 | 171 |    +--------------+-----------------------------------------------------------+ | 
 | 172 |    | textvariable | Specifies a name whose value will be used in place of the | | 
 | 173 |    |              | text option resource.                                     | | 
 | 174 |    +--------------+-----------------------------------------------------------+ | 
 | 175 |    | underline    | If set, specifies the index (0-based) of a character to   | | 
 | 176 |    |              | underline in the text string. The underline character is  | | 
 | 177 |    |              | used for mnemonic activation.                             | | 
 | 178 |    +--------------+-----------------------------------------------------------+ | 
 | 179 |    | image        | Specifies an image to display. This is a list of 1 or more| | 
 | 180 |    |              | elements. The first element is the default image name. The| | 
 | 181 |    |              | rest of the list if a sequence of statespec/value pairs as| | 
 | 182 |    |              | defined by :meth:`Style.map`, specifying different images | | 
 | 183 |    |              | to use when the widget is in a particular state or a      | | 
 | 184 |    |              | combination of states. All images in the list should have | | 
 | 185 |    |              | the same size.                                            | | 
 | 186 |    +--------------+-----------------------------------------------------------+ | 
 | 187 |    | compound     | Specifies how to display the image relative to the text,  | | 
 | 188 |    |              | in the case both text and images options are present.     | | 
 | 189 |    |              | Valid values are:                                         | | 
 | 190 |    |              |                                                           | | 
 | 191 |    |              | * text: display text only                                 | | 
 | 192 |    |              | * image: display image only                               | | 
 | 193 |    |              | * top, bottom, left, right: display image above, below,   | | 
 | 194 |    |              |   left of, or right of the text, respectively.            | | 
 | 195 |    |              | * none: the default. display the image if present,        | | 
 | 196 |    |              |   otherwise the text.                                     | | 
 | 197 |    +--------------+-----------------------------------------------------------+ | 
 | 198 |    | width        | If greater than zero, specifies how much space, in        | | 
 | 199 |    |              | character widths, to allocate for the text label, if less | | 
 | 200 |    |              | than zero, specifies a minimum width. If zero or          | | 
 | 201 |    |              | unspecified, the natural width of the text label is used. | | 
 | 202 |    +--------------+-----------------------------------------------------------+ | 
 | 203 |  | 
 | 204 |  | 
 | 205 | Compatibility Options | 
 | 206 | ^^^^^^^^^^^^^^^^^^^^^ | 
 | 207 |  | 
| Georg Brandl | 44ea77b | 2013-03-28 13:28:44 +0100 | [diff] [blame] | 208 |    .. tabularcolumns:: |l|L| | 
 | 209 |  | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 210 |    +--------+----------------------------------------------------------------+ | 
| Georg Brandl | 44ea77b | 2013-03-28 13:28:44 +0100 | [diff] [blame] | 211 |    | Option | Description                                                    | | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 212 |    +========+================================================================+ | 
 | 213 |    | state  | May be set to "normal" or "disabled" to control the "disabled" | | 
 | 214 |    |        | state bit. This is a write-only option: setting it changes the | | 
 | 215 |    |        | widget state, but the :meth:`Widget.state` method does not     | | 
 | 216 |    |        | affect this option.                                            | | 
 | 217 |    +--------+----------------------------------------------------------------+ | 
 | 218 |  | 
 | 219 | Widget States | 
 | 220 | ^^^^^^^^^^^^^ | 
 | 221 |  | 
 | 222 | The widget state is a bitmap of independent state flags. | 
 | 223 |  | 
| Georg Brandl | 44ea77b | 2013-03-28 13:28:44 +0100 | [diff] [blame] | 224 |    .. tabularcolumns:: |l|L| | 
 | 225 |  | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 226 |    +------------+-------------------------------------------------------------+ | 
| Georg Brandl | 44ea77b | 2013-03-28 13:28:44 +0100 | [diff] [blame] | 227 |    | Flag       | Description                                                 | | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 228 |    +============+=============================================================+ | 
 | 229 |    | active     | The mouse cursor is over the widget and pressing a mouse    | | 
 | 230 |    |            | button will cause some action to occur                      | | 
 | 231 |    +------------+-------------------------------------------------------------+ | 
 | 232 |    | disabled   | Widget is disabled under program control                    | | 
 | 233 |    +------------+-------------------------------------------------------------+ | 
 | 234 |    | focus      | Widget has keyboard focus                                   | | 
 | 235 |    +------------+-------------------------------------------------------------+ | 
 | 236 |    | pressed    | Widget is being pressed                                     | | 
 | 237 |    +------------+-------------------------------------------------------------+ | 
 | 238 |    | selected   | "On", "true", or "current" for things like Checkbuttons and | | 
 | 239 |    |            | radiobuttons                                                | | 
 | 240 |    +------------+-------------------------------------------------------------+ | 
 | 241 |    | background | Windows and Mac have a notion of an "active" or foreground  | | 
 | 242 |    |            | window. The *background* state is set for widgets in a      | | 
 | 243 |    |            | background window, and cleared for those in the foreground  | | 
 | 244 |    |            | window                                                      | | 
 | 245 |    +------------+-------------------------------------------------------------+ | 
 | 246 |    | readonly   | Widget should not allow user modification                   | | 
 | 247 |    +------------+-------------------------------------------------------------+ | 
 | 248 |    | alternate  | A widget-specific alternate display format                  | | 
 | 249 |    +------------+-------------------------------------------------------------+ | 
 | 250 |    | invalid    | The widget's value is invalid                               | | 
 | 251 |    +------------+-------------------------------------------------------------+ | 
 | 252 |  | 
 | 253 | A state specification is a sequence of state names, optionally prefixed with | 
 | 254 | an exclamation point indicating that the bit is off. | 
 | 255 |  | 
 | 256 |  | 
 | 257 | ttk.Widget | 
 | 258 | ^^^^^^^^^^ | 
 | 259 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 260 | Besides the methods described below, the :class:`ttk.Widget` supports the | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 261 | methods :meth:`tkinter.Widget.cget` and :meth:`tkinter.Widget.configure`. | 
 | 262 |  | 
 | 263 | .. class:: Widget | 
 | 264 |  | 
 | 265 |    .. method:: identify(x, y) | 
 | 266 |  | 
 | 267 |       Returns the name of the element at position *x* *y*, or the empty string | 
 | 268 |       if the point does not lie within any element. | 
 | 269 |  | 
 | 270 |       *x* and *y* are pixel coordinates relative to the widget. | 
 | 271 |  | 
 | 272 |  | 
| Georg Brandl | 7f01a13 | 2009-09-16 15:58:14 +0000 | [diff] [blame] | 273 |    .. method:: instate(statespec, callback=None, *args, **kw) | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 274 |  | 
 | 275 |       Test the widget's state. If a callback is not specified, returns True | 
 | 276 |       if the widget state matches *statespec* and False otherwise. If callback | 
 | 277 |       is specified then it is called with args if widget state matches | 
 | 278 |       *statespec*. | 
 | 279 |  | 
 | 280 |  | 
| Georg Brandl | 7f01a13 | 2009-09-16 15:58:14 +0000 | [diff] [blame] | 281 |    .. method:: state(statespec=None) | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 282 |  | 
 | 283 |       Modify or inquire widget state. If *statespec* is specified, sets the | 
 | 284 |       widget state according to it and return a new *statespec* indicating | 
 | 285 |       which flags were changed. If *statespec* is not specified, returns | 
 | 286 |       the currently-enabled state flags. | 
 | 287 |  | 
 | 288 |    *statespec* will usually be a list or a tuple. | 
 | 289 |  | 
 | 290 |  | 
 | 291 | Combobox | 
 | 292 | -------- | 
 | 293 |  | 
 | 294 | The :class:`ttk.Combobox` widget combines a text field with a pop-down list of | 
 | 295 | values. This widget is a subclass of :class:`Entry`. | 
 | 296 |  | 
 | 297 | Besides the methods inherited from :class:`Widget`: :meth:`Widget.cget`, | 
 | 298 | :meth:`Widget.configure`, :meth:`Widget.identify`, :meth:`Widget.instate` | 
 | 299 | and :meth:`Widget.state`, and the following inherited from :class:`Entry`: | 
 | 300 | :meth:`Entry.bbox`, :meth:`Entry.delete`, :meth:`Entry.icursor`, | 
 | 301 | :meth:`Entry.index`, :meth:`Entry.inset`, :meth:`Entry.selection`, | 
 | 302 | :meth:`Entry.xview`, it has some other methods, described at | 
 | 303 | :class:`ttk.Combobox`. | 
 | 304 |  | 
 | 305 |  | 
 | 306 | Options | 
 | 307 | ^^^^^^^ | 
 | 308 |  | 
 | 309 | This widget accepts the following specific options: | 
 | 310 |  | 
| Georg Brandl | 44ea77b | 2013-03-28 13:28:44 +0100 | [diff] [blame] | 311 |    .. tabularcolumns:: |l|L| | 
 | 312 |  | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 313 |    +-----------------+--------------------------------------------------------+ | 
| Georg Brandl | 44ea77b | 2013-03-28 13:28:44 +0100 | [diff] [blame] | 314 |    | Option          | Description                                            | | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 315 |    +=================+========================================================+ | 
 | 316 |    | exportselection | Boolean value. If set, the widget selection is linked  | | 
 | 317 |    |                 | to the Window Manager selection (which can be returned | | 
 | 318 |    |                 | by invoking Misc.selection_get, for example).          | | 
 | 319 |    +-----------------+--------------------------------------------------------+ | 
 | 320 |    | justify         | Specifies how the text is aligned within the widget.   | | 
 | 321 |    |                 | One of "left", "center", or "right".                   | | 
 | 322 |    +-----------------+--------------------------------------------------------+ | 
 | 323 |    | height          | Specifies the height of the pop-down listbox, in rows. | | 
 | 324 |    +-----------------+--------------------------------------------------------+ | 
 | 325 |    | postcommand     | A script (possibly registered with Misc.register) that | | 
 | 326 |    |                 | is called immediately before displaying the values. It | | 
 | 327 |    |                 | may specify which values to display.                   | | 
 | 328 |    +-----------------+--------------------------------------------------------+ | 
 | 329 |    | state           | One of "normal", "readonly", or "disabled". In the     | | 
 | 330 |    |                 | "readonly" state, the value may not be edited directly,| | 
 | 331 |    |                 | and the user can only selection of the values from the | | 
 | 332 |    |                 | dropdown list. In the "normal" state, the text field is| | 
 | 333 |    |                 | directly editable. In the "disabled" state, no         | | 
 | 334 |    |                 | interaction is possible.                               | | 
 | 335 |    +-----------------+--------------------------------------------------------+ | 
 | 336 |    | textvariable    | Specifies a name whose value is linked to the widget   | | 
 | 337 |    |                 | value. Whenever the value associated with that name    | | 
 | 338 |    |                 | changes, the widget value is updated, and vice versa.  | | 
 | 339 |    |                 | See :class:`tkinter.StringVar`.                        | | 
 | 340 |    +-----------------+--------------------------------------------------------+ | 
 | 341 |    | values          | Specifies the list of values to display in the         | | 
 | 342 |    |                 | drop-down listbox.                                     | | 
 | 343 |    +-----------------+--------------------------------------------------------+ | 
 | 344 |    | width           | Specifies an integer value indicating the desired width| | 
 | 345 |    |                 | of the entry window, in average-size characters of the | | 
 | 346 |    |                 | widget's font.                                         | | 
 | 347 |    +-----------------+--------------------------------------------------------+ | 
 | 348 |  | 
 | 349 |  | 
 | 350 | Virtual events | 
 | 351 | ^^^^^^^^^^^^^^ | 
 | 352 |  | 
 | 353 | The combobox widgets generates a **<<ComboboxSelected>>** virtual event | 
 | 354 | when the user selects an element from the list of values. | 
 | 355 |  | 
 | 356 |  | 
 | 357 | ttk.Combobox | 
 | 358 | ^^^^^^^^^^^^ | 
 | 359 |  | 
 | 360 | .. class:: Combobox | 
 | 361 |  | 
| Georg Brandl | 7f01a13 | 2009-09-16 15:58:14 +0000 | [diff] [blame] | 362 |    .. method:: current(newindex=None) | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 363 |  | 
 | 364 |       If *newindex* is specified, sets the combobox value to the element | 
 | 365 |       position *newindex*. Otherwise, returns the index of the current value or | 
 | 366 |       -1 if the current value is not in the values list. | 
 | 367 |  | 
 | 368 |  | 
 | 369 |    .. method:: get() | 
 | 370 |  | 
 | 371 |       Returns the current value of the combobox. | 
 | 372 |  | 
 | 373 |  | 
 | 374 |    .. method:: set(value) | 
 | 375 |  | 
 | 376 |       Sets the value of the combobox to *value*. | 
 | 377 |  | 
 | 378 |  | 
 | 379 | Notebook | 
 | 380 | -------- | 
 | 381 |  | 
 | 382 | Ttk Notebook widget manages a collection of windows and displays a single | 
 | 383 | one at a time. Each child window is associated with a tab, which the user | 
 | 384 | may select to change the currently-displayed window. | 
 | 385 |  | 
 | 386 |  | 
 | 387 | Options | 
 | 388 | ^^^^^^^ | 
 | 389 |  | 
 | 390 | This widget accepts the following specific options: | 
 | 391 |  | 
| Georg Brandl | 44ea77b | 2013-03-28 13:28:44 +0100 | [diff] [blame] | 392 |    .. tabularcolumns:: |l|L| | 
 | 393 |  | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 394 |    +---------+----------------------------------------------------------------+ | 
| Georg Brandl | 44ea77b | 2013-03-28 13:28:44 +0100 | [diff] [blame] | 395 |    | Option  | Description                                                    | | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 396 |    +=========+================================================================+ | 
 | 397 |    | height  | If present and greater than zero, specifies the desired height | | 
 | 398 |    |         | of the pane area (not including internal padding or tabs).     | | 
 | 399 |    |         | Otherwise, the maximum height of all panes is used.            | | 
 | 400 |    +---------+----------------------------------------------------------------+ | 
 | 401 |    | padding | Specifies the amount of extra space to add around the outside  | | 
 | 402 |    |         | of the notebook. The padding is a list up to four length       | | 
 | 403 |    |         | specifications left top right bottom. If fewer than four       | | 
 | 404 |    |         | elements are specified, bottom defaults to top, right defaults | | 
 | 405 |    |         | to left, and top defaults to left.                             | | 
 | 406 |    +---------+----------------------------------------------------------------+ | 
 | 407 |    | width   | If present and greater than zero, specified the desired width  | | 
 | 408 |    |         | of the pane area (not including internal padding). Otherwise,  | | 
 | 409 |    |         | the maximum width of all panes is used.                        | | 
 | 410 |    +---------+----------------------------------------------------------------+ | 
 | 411 |  | 
 | 412 |  | 
 | 413 | Tab Options | 
 | 414 | ^^^^^^^^^^^ | 
 | 415 |  | 
 | 416 | There are also specific options for tabs: | 
 | 417 |  | 
| Georg Brandl | 44ea77b | 2013-03-28 13:28:44 +0100 | [diff] [blame] | 418 |    .. tabularcolumns:: |l|L| | 
 | 419 |  | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 420 |    +-----------+--------------------------------------------------------------+ | 
| Georg Brandl | 44ea77b | 2013-03-28 13:28:44 +0100 | [diff] [blame] | 421 |    | Option    | Description                                                  | | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 422 |    +===========+==============================================================+ | 
 | 423 |    | state     | Either "normal", "disabled" or "hidden". If "disabled", then | | 
 | 424 |    |           | the tab is not selectable. If "hidden", then the tab is not  | | 
 | 425 |    |           | shown.                                                       | | 
 | 426 |    +-----------+--------------------------------------------------------------+ | 
 | 427 |    | sticky    | Specifies how the child window is positioned within the pane | | 
 | 428 |    |           | area. Value is a string containing zero or more of the       | | 
 | 429 |    |           | characters "n", "s", "e" or "w". Each letter refers to a     | | 
 | 430 |    |           | side (north, south, east or west) that the child window will | | 
 | 431 |    |           | stick to, as per the :meth:`grid` geometry manager.          | | 
 | 432 |    +-----------+--------------------------------------------------------------+ | 
 | 433 |    | padding   | Specifies the amount of extra space to add between the       | | 
 | 434 |    |           | notebook and this pane. Syntax is the same as for the option | | 
 | 435 |    |           | padding used by this widget.                                 | | 
 | 436 |    +-----------+--------------------------------------------------------------+ | 
 | 437 |    | text      | Specifies a text to be displayed in the tab.                 | | 
 | 438 |    +-----------+--------------------------------------------------------------+ | 
 | 439 |    | image     | Specifies an image to display in the tab. See the option     | | 
 | 440 |    |           | image described in :class:`Widget`.                          | | 
 | 441 |    +-----------+--------------------------------------------------------------+ | 
 | 442 |    | compound  | Specifies how to display the image relative to the text, in  | | 
 | 443 |    |           | the case both options text and image are present. See        | | 
 | 444 |    |           | `Label Options`_ for legal values.                           | | 
 | 445 |    +-----------+--------------------------------------------------------------+ | 
 | 446 |    | underline | Specifies the index (0-based) of a character to underline in | | 
 | 447 |    |           | the text string. The underlined character is used for        | | 
 | 448 |    |           | mnemonic activation if :meth:`Notebook.enable_traversal` is  | | 
 | 449 |    |           | called.                                                      | | 
 | 450 |    +-----------+--------------------------------------------------------------+ | 
 | 451 |  | 
 | 452 |  | 
 | 453 | Tab Identifiers | 
 | 454 | ^^^^^^^^^^^^^^^ | 
 | 455 |  | 
 | 456 | The tab_id present in several methods of :class:`ttk.Notebook` may take any | 
 | 457 | of the following forms: | 
 | 458 |  | 
 | 459 | * An integer between zero and the number of tabs | 
 | 460 | * The name of a child window | 
 | 461 | * A positional specification of the form "@x,y", which identifies the tab | 
 | 462 | * The literal string "current", which identifies the currently-selected tab | 
 | 463 | * The literal string "end", which returns the number of tabs (only valid for | 
 | 464 |   :meth:`Notebook.index`) | 
 | 465 |  | 
 | 466 |  | 
 | 467 | Virtual Events | 
 | 468 | ^^^^^^^^^^^^^^ | 
 | 469 |  | 
 | 470 | This widget generates a **<<NotebookTabChanged>>** virtual event after a new | 
 | 471 | tab is selected. | 
 | 472 |  | 
 | 473 |  | 
 | 474 | ttk.Notebook | 
 | 475 | ^^^^^^^^^^^^ | 
 | 476 |  | 
 | 477 | .. class:: Notebook | 
 | 478 |  | 
 | 479 |    .. method:: add(child, **kw) | 
 | 480 |  | 
 | 481 |       Adds a new tab to the notebook. | 
 | 482 |  | 
 | 483 |       If window is currently managed by the notebook but hidden, it is | 
 | 484 |       restored to its previous position. | 
 | 485 |  | 
 | 486 |       See `Tab Options`_ for the list of available options. | 
 | 487 |  | 
 | 488 |  | 
 | 489 |    .. method:: forget(tab_id) | 
 | 490 |  | 
 | 491 |       Removes the tab specified by *tab_id*, unmaps and unmanages the | 
 | 492 |       associated window. | 
 | 493 |  | 
 | 494 |  | 
 | 495 |    .. method:: hide(tab_id) | 
 | 496 |  | 
 | 497 |       Hides the tab specified by *tab_id*. | 
 | 498 |  | 
 | 499 |       The tab will not be displayed, but the associated window remains | 
 | 500 |       managed by the notebook and its configuration remembered. Hidden tabs | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 501 |       may be restored with the :meth:`add` command. | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 502 |  | 
 | 503 |  | 
 | 504 |    .. method:: identify(x, y) | 
 | 505 |  | 
 | 506 |       Returns the name of the tab element at position *x*, *y*, or the empty | 
 | 507 |       string if none. | 
 | 508 |  | 
 | 509 |  | 
 | 510 |    .. method:: index(tab_id) | 
 | 511 |  | 
 | 512 |       Returns the numeric index of the tab specified by *tab_id*, or the total | 
 | 513 |       number of tabs if *tab_id* is the string "end". | 
 | 514 |  | 
 | 515 |  | 
 | 516 |    .. method:: insert(pos, child, **kw) | 
 | 517 |  | 
 | 518 |       Inserts a pane at the specified position. | 
 | 519 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 520 |       *pos* is either the string "end", an integer index, or the name of a | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 521 |       managed child. If *child* is already managed by the notebook, moves it to | 
 | 522 |       the specified position. | 
 | 523 |  | 
 | 524 |       See `Tab Options`_ for the list of available options. | 
 | 525 |  | 
 | 526 |  | 
| Georg Brandl | 7f01a13 | 2009-09-16 15:58:14 +0000 | [diff] [blame] | 527 |    .. method:: select(tab_id=None) | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 528 |  | 
 | 529 |       Selects the specified *tab_id*. | 
 | 530 |  | 
 | 531 |       The associated child window will be displayed, and the | 
 | 532 |       previously-selected window (if different) is unmapped. If *tab_id* is | 
 | 533 |       omitted, returns the widget name of the currently selected pane. | 
 | 534 |  | 
 | 535 |  | 
| Georg Brandl | 7f01a13 | 2009-09-16 15:58:14 +0000 | [diff] [blame] | 536 |    .. method:: tab(tab_id, option=None, **kw) | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 537 |  | 
 | 538 |       Query or modify the options of the specific *tab_id*. | 
 | 539 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 540 |       If *kw* is not given, returns a dictionary of the tab option values. If | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 541 |       *option* is specified, returns the value of that *option*. Otherwise, | 
 | 542 |       sets the options to the corresponding values. | 
 | 543 |  | 
 | 544 |  | 
 | 545 |    .. method:: tabs() | 
 | 546 |  | 
 | 547 |       Returns a list of windows managed by the notebook. | 
 | 548 |  | 
 | 549 |  | 
 | 550 |    .. method:: enable_traversal() | 
 | 551 |  | 
 | 552 |       Enable keyboard traversal for a toplevel window containing this notebook. | 
 | 553 |  | 
 | 554 |       This will extend the bindings for the toplevel window containing the | 
 | 555 |       notebook as follows: | 
 | 556 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 557 |       * Control-Tab: selects the tab following the currently selected one. | 
 | 558 |       * Shift-Control-Tab: selects the tab preceding the currently selected one. | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 559 |       * Alt-K: where K is the mnemonic (underlined) character of any tab, will | 
 | 560 |         select that tab. | 
 | 561 |  | 
 | 562 |       Multiple notebooks in a single toplevel may be enabled for traversal, | 
 | 563 |       including nested notebooks. However, notebook traversal only works | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 564 |       properly if all panes have the notebook they are in as master. | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 565 |  | 
 | 566 |  | 
 | 567 | Progressbar | 
 | 568 | ----------- | 
 | 569 |  | 
 | 570 | The :class:`ttk.Progressbar` widget shows the status of a long-running | 
| Raymond Hettinger | 238018c | 2009-04-08 08:23:44 +0000 | [diff] [blame] | 571 | operation. It can operate in two modes:  1) the determinate mode which shows the | 
 | 572 | amount completed relative to the total amount of work to be done and 2) the | 
 | 573 | indeterminate mode which provides an animated display to let the user know that | 
 | 574 | work is progressing. | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 575 |  | 
 | 576 |  | 
 | 577 | Options | 
 | 578 | ^^^^^^^ | 
 | 579 |  | 
 | 580 | This widget accepts the following specific options: | 
 | 581 |  | 
| Georg Brandl | 44ea77b | 2013-03-28 13:28:44 +0100 | [diff] [blame] | 582 |    .. tabularcolumns:: |l|L| | 
 | 583 |  | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 584 |    +----------+---------------------------------------------------------------+ | 
| Georg Brandl | 44ea77b | 2013-03-28 13:28:44 +0100 | [diff] [blame] | 585 |    | Option   | Description                                                   | | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 586 |    +==========+===============================================================+ | 
 | 587 |    | orient   | One of "horizontal" or "vertical". Specifies the orientation  | | 
 | 588 |    |          | of the progress bar.                                          | | 
 | 589 |    +----------+---------------------------------------------------------------+ | 
 | 590 |    | length   | Specifies the length of the long axis of the progress bar     | | 
 | 591 |    |          | (width if horizontal, height if vertical).                    | | 
 | 592 |    +----------+---------------------------------------------------------------+ | 
 | 593 |    | mode     | One of "determinate" or "indeterminate".                      | | 
 | 594 |    +----------+---------------------------------------------------------------+ | 
 | 595 |    | maximum  | A number specifying the maximum value. Defaults to 100.       | | 
 | 596 |    +----------+---------------------------------------------------------------+ | 
 | 597 |    | value    | The current value of the progress bar. In "determinate" mode, | | 
 | 598 |    |          | this represents the amount of work completed. In              | | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 599 |    |          | "indeterminate" mode, it is interpreted as modulo *maximum*;  | | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 600 |    |          | that is, the progress bar completes one "cycle" when its value| | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 601 |    |          | increases by *maximum*.                                       | | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 602 |    +----------+---------------------------------------------------------------+ | 
 | 603 |    | variable | A name which is linked to the option value. If specified, the | | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 604 |    |          | value of the progress bar is automatically set to the value of| | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 605 |    |          | this name whenever the latter is modified.                    | | 
 | 606 |    +----------+---------------------------------------------------------------+ | 
 | 607 |    | phase    | Read-only option. The widget periodically increments the value| | 
 | 608 |    |          | of this option whenever its value is greater than 0 and, in   | | 
 | 609 |    |          | determinate mode, less than maximum. This option may be used  | | 
 | 610 |    |          | by the current theme to provide additional animation effects. | | 
 | 611 |    +----------+---------------------------------------------------------------+ | 
 | 612 |  | 
 | 613 |  | 
 | 614 | ttk.Progressbar | 
 | 615 | ^^^^^^^^^^^^^^^ | 
 | 616 |  | 
 | 617 | .. class:: Progressbar | 
 | 618 |  | 
| Georg Brandl | 7f01a13 | 2009-09-16 15:58:14 +0000 | [diff] [blame] | 619 |    .. method:: start(interval=None) | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 620 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 621 |       Begin autoincrement mode: schedules a recurring timer event that calls | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 622 |       :meth:`Progressbar.step` every *interval* milliseconds. If omitted, | 
 | 623 |       *interval* defaults to 50 milliseconds. | 
 | 624 |  | 
 | 625 |  | 
| Georg Brandl | 7f01a13 | 2009-09-16 15:58:14 +0000 | [diff] [blame] | 626 |    .. method:: step(amount=None) | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 627 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 628 |       Increments the progress bar's value by *amount*. | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 629 |  | 
 | 630 |       *amount* defaults to 1.0 if omitted. | 
 | 631 |  | 
 | 632 |  | 
 | 633 |    .. method:: stop() | 
 | 634 |  | 
 | 635 |       Stop autoincrement mode: cancels any recurring timer event initiated by | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 636 |       :meth:`Progressbar.start` for this progress bar. | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 637 |  | 
 | 638 |  | 
 | 639 | Separator | 
 | 640 | --------- | 
 | 641 |  | 
 | 642 | The :class:`ttk.Separator` widget displays a horizontal or vertical separator | 
 | 643 | bar. | 
 | 644 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 645 | It has no other methods besides the ones inherited from :class:`ttk.Widget`. | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 646 |  | 
 | 647 |  | 
 | 648 | Options | 
 | 649 | ^^^^^^^ | 
 | 650 |  | 
 | 651 | This widget accepts the following specific option: | 
 | 652 |  | 
| Georg Brandl | 44ea77b | 2013-03-28 13:28:44 +0100 | [diff] [blame] | 653 |    .. tabularcolumns:: |l|L| | 
 | 654 |  | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 655 |    +--------+----------------------------------------------------------------+ | 
| Georg Brandl | 44ea77b | 2013-03-28 13:28:44 +0100 | [diff] [blame] | 656 |    | Option | Description                                                    | | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 657 |    +========+================================================================+ | 
 | 658 |    | orient | One of "horizontal" or "vertical". Specifies the orientation of| | 
 | 659 |    |        | the separator.                                                 | | 
 | 660 |    +--------+----------------------------------------------------------------+ | 
 | 661 |  | 
 | 662 |  | 
 | 663 | Sizegrip | 
 | 664 | -------- | 
 | 665 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 666 | The :class:`ttk.Sizegrip` widget (also known as a grow box) allows the user to | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 667 | resize the containing toplevel window by pressing and dragging the grip. | 
 | 668 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 669 | This widget has neither specific options nor specific methods, besides the | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 670 | ones inherited from :class:`ttk.Widget`. | 
 | 671 |  | 
 | 672 |  | 
 | 673 | Platform-specific notes | 
 | 674 | ^^^^^^^^^^^^^^^^^^^^^^^ | 
 | 675 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 676 | * On MacOS X, toplevel windows automatically include a built-in size grip | 
 | 677 |   by default. Adding a :class:`Sizegrip` is harmless, since the built-in | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 678 |   grip will just mask the widget. | 
 | 679 |  | 
 | 680 |  | 
 | 681 | Bugs | 
 | 682 | ^^^^ | 
 | 683 |  | 
 | 684 | * If the containing toplevel's position was specified relative to the right | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 685 |   or bottom of the screen (e.g. ....), the :class:`Sizegrip` widget will | 
 | 686 |   not resize the window. | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 687 | * This widget supports only "southeast" resizing. | 
 | 688 |  | 
 | 689 |  | 
 | 690 | Treeview | 
 | 691 | -------- | 
 | 692 |  | 
 | 693 | The :class:`ttk.Treeview` widget displays a hierarchical collection of items. | 
 | 694 | Each item has a textual label, an optional image, and an optional list of data | 
 | 695 | values. The data values are displayed in successive columns after the tree | 
 | 696 | label. | 
 | 697 |  | 
 | 698 | The order in which data values are displayed may be controlled by setting | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 699 | the widget option ``displaycolumns``. The tree widget can also display column | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 700 | headings. Columns may be accessed by number or symbolic names listed in the | 
 | 701 | widget option columns. See `Column Identifiers`_. | 
 | 702 |  | 
 | 703 | Each item is identified by an unique name. The widget will generate item IDs | 
 | 704 | if they are not supplied by the caller. There is a distinguished root item, | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 705 | named ``{}``. The root item itself is not displayed; its children appear at the | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 706 | top level of the hierarchy. | 
 | 707 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 708 | Each item also has a list of tags, which can be used to associate event bindings | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 709 | with individual items and control the appearance of the item. | 
 | 710 |  | 
 | 711 | The Treeview widget supports horizontal and vertical scrolling, according to | 
 | 712 | the options described in `Scrollable Widget Options`_ and the methods | 
 | 713 | :meth:`Treeview.xview` and :meth:`Treeview.yview`. | 
 | 714 |  | 
 | 715 |  | 
 | 716 | Options | 
 | 717 | ^^^^^^^ | 
 | 718 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 719 | This widget accepts the following specific options: | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 720 |  | 
| Georg Brandl | 44ea77b | 2013-03-28 13:28:44 +0100 | [diff] [blame] | 721 |    .. tabularcolumns:: |l|p{0.7\linewidth}| | 
| Georg Brandl | 2c86004 | 2009-06-16 19:24:38 +0000 | [diff] [blame] | 722 |  | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 723 |    +----------------+--------------------------------------------------------+ | 
| Georg Brandl | 44ea77b | 2013-03-28 13:28:44 +0100 | [diff] [blame] | 724 |    | Option         | Description                                            | | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 725 |    +================+========================================================+ | 
 | 726 |    | columns        | A list of column identifiers, specifying the number of | | 
 | 727 |    |                | columns and their names.                               | | 
 | 728 |    +----------------+--------------------------------------------------------+ | 
 | 729 |    | displaycolumns | A list of column identifiers (either symbolic or       | | 
 | 730 |    |                | integer indices) specifying which data columns are     | | 
 | 731 |    |                | displayed and the order in which they appear, or the   | | 
 | 732 |    |                | string "#all".                                         | | 
 | 733 |    +----------------+--------------------------------------------------------+ | 
 | 734 |    | height         | Specifies the number of rows which should be visible.  | | 
 | 735 |    |                | Note: the requested width is determined from the sum   | | 
 | 736 |    |                | of the column widths.                                  | | 
 | 737 |    +----------------+--------------------------------------------------------+ | 
 | 738 |    | padding        | Specifies the internal padding for the widget. The     | | 
 | 739 |    |                | padding is a list of up to four length specifications. | | 
 | 740 |    +----------------+--------------------------------------------------------+ | 
 | 741 |    | selectmode     | Controls how the built-in class bindings manage the    | | 
 | 742 |    |                | selection. One of "extended", "browse" or "none".      | | 
 | 743 |    |                | If set to "extended" (the default), multiple items may | | 
 | 744 |    |                | be selected. If "browse", only a single item will be   | | 
 | 745 |    |                | selected at a time. If "none", the selection will not  | | 
 | 746 |    |                | be changed.                                            | | 
 | 747 |    |                |                                                        | | 
 | 748 |    |                | Note that the application code and tag bindings can set| | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 749 |    |                | the selection however they wish, regardless of the     | | 
 | 750 |    |                | value  of this option.                                 | | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 751 |    +----------------+--------------------------------------------------------+ | 
 | 752 |    | show           | A list containing zero or more of the following values,| | 
 | 753 |    |                | specifying which elements of the tree to display.      | | 
 | 754 |    |                |                                                        | | 
 | 755 |    |                | * tree: display tree labels in column #0.              | | 
 | 756 |    |                | * headings: display the heading row.                   | | 
 | 757 |    |                |                                                        | | 
 | 758 |    |                | The default is "tree headings", i.e., show all         | | 
 | 759 |    |                | elements.                                              | | 
 | 760 |    |                |                                                        | | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 761 |    |                | **Note**: Column #0 always refers to the tree column,  | | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 762 |    |                | even if show="tree" is not specified.                  | | 
 | 763 |    +----------------+--------------------------------------------------------+ | 
 | 764 |  | 
 | 765 |  | 
 | 766 | Item Options | 
 | 767 | ^^^^^^^^^^^^ | 
 | 768 |  | 
 | 769 | The following item options may be specified for items in the insert and item | 
 | 770 | widget commands. | 
 | 771 |  | 
| Georg Brandl | 44ea77b | 2013-03-28 13:28:44 +0100 | [diff] [blame] | 772 |    .. tabularcolumns:: |l|L| | 
 | 773 |  | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 774 |    +--------+---------------------------------------------------------------+ | 
| Georg Brandl | 44ea77b | 2013-03-28 13:28:44 +0100 | [diff] [blame] | 775 |    | Option | Description                                                   | | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 776 |    +========+===============================================================+ | 
 | 777 |    | text   | The textual label to display for the item.                    | | 
 | 778 |    +--------+---------------------------------------------------------------+ | 
 | 779 |    | image  | A Tk Image, displayed to the left of the label.               | | 
 | 780 |    +--------+---------------------------------------------------------------+ | 
 | 781 |    | values | The list of values associated with the item.                  | | 
 | 782 |    |        |                                                               | | 
 | 783 |    |        | Each item should have the same number of values as the widget | | 
 | 784 |    |        | option columns. If there are fewer values than columns, the   | | 
 | 785 |    |        | remaining values are assumed empty. If there are more values  | | 
 | 786 |    |        | than columns, the extra values are ignored.                   | | 
 | 787 |    +--------+---------------------------------------------------------------+ | 
 | 788 |    | open   | True/False value indicating whether the item's children should| | 
 | 789 |    |        | be displayed or hidden.                                       | | 
 | 790 |    +--------+---------------------------------------------------------------+ | 
 | 791 |    | tags   | A list of tags associated with this item.                     | | 
 | 792 |    +--------+---------------------------------------------------------------+ | 
 | 793 |  | 
 | 794 |  | 
 | 795 | Tag Options | 
 | 796 | ^^^^^^^^^^^ | 
 | 797 |  | 
 | 798 | The following options may be specified on tags: | 
 | 799 |  | 
| Georg Brandl | 44ea77b | 2013-03-28 13:28:44 +0100 | [diff] [blame] | 800 |    .. tabularcolumns:: |l|L| | 
 | 801 |  | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 802 |    +------------+-----------------------------------------------------------+ | 
| Georg Brandl | 44ea77b | 2013-03-28 13:28:44 +0100 | [diff] [blame] | 803 |    | Option     | Description                                               | | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 804 |    +============+===========================================================+ | 
 | 805 |    | foreground | Specifies the text foreground color.                      | | 
 | 806 |    +------------+-----------------------------------------------------------+ | 
 | 807 |    | background | Specifies the cell or item background color.              | | 
 | 808 |    +------------+-----------------------------------------------------------+ | 
 | 809 |    | font       | Specifies the font to use when drawing text.              | | 
 | 810 |    +------------+-----------------------------------------------------------+ | 
 | 811 |    | image      | Specifies the item image, in case the item's image option | | 
 | 812 |    |            | is empty.                                                 | | 
 | 813 |    +------------+-----------------------------------------------------------+ | 
 | 814 |  | 
 | 815 |  | 
 | 816 | Column Identifiers | 
 | 817 | ^^^^^^^^^^^^^^^^^^ | 
 | 818 |  | 
 | 819 | Column identifiers take any of the following forms: | 
 | 820 |  | 
 | 821 | * A symbolic name from the list of columns option. | 
 | 822 | * An integer n, specifying the nth data column. | 
 | 823 | * A string of the form #n, where n is an integer, specifying the nth display | 
 | 824 |   column. | 
 | 825 |  | 
 | 826 | Notes: | 
 | 827 |  | 
 | 828 | * Item's option values may be displayed in a different order than the order | 
 | 829 |   in which they are stored. | 
 | 830 | * Column #0 always refers to the tree column, even if show="tree" is not | 
 | 831 |   specified. | 
 | 832 |  | 
 | 833 | A data column number is an index into an item's option values list; a display | 
 | 834 | column number is the column number in the tree where the values are displayed. | 
 | 835 | Tree labels are displayed in column #0. If option displaycolumns is not set, | 
 | 836 | then data column n is displayed in column #n+1. Again, **column #0 always | 
 | 837 | refers to the tree column**. | 
 | 838 |  | 
 | 839 |  | 
 | 840 | Virtual Events | 
 | 841 | ^^^^^^^^^^^^^^ | 
 | 842 |  | 
 | 843 | The Treeview widget generates the following virtual events. | 
 | 844 |  | 
| Georg Brandl | 44ea77b | 2013-03-28 13:28:44 +0100 | [diff] [blame] | 845 |    .. tabularcolumns:: |l|L| | 
 | 846 |  | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 847 |    +--------------------+--------------------------------------------------+ | 
| Georg Brandl | 44ea77b | 2013-03-28 13:28:44 +0100 | [diff] [blame] | 848 |    | Event              | Description                                      | | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 849 |    +====================+==================================================+ | 
 | 850 |    | <<TreeviewSelect>> | Generated whenever the selection changes.        | | 
 | 851 |    +--------------------+--------------------------------------------------+ | 
 | 852 |    | <<TreeviewOpen>>   | Generated just before settings the focus item to | | 
 | 853 |    |                    | open=True.                                       | | 
 | 854 |    +--------------------+--------------------------------------------------+ | 
 | 855 |    | <<TreeviewClose>>  | Generated just after setting the focus item to   | | 
 | 856 |    |                    | open=False.                                      | | 
 | 857 |    +--------------------+--------------------------------------------------+ | 
 | 858 |  | 
 | 859 | The :meth:`Treeview.focus` and :meth:`Treeview.selection` methods can be used | 
 | 860 | to determine the affected item or items. | 
 | 861 |  | 
 | 862 |  | 
 | 863 | ttk.Treeview | 
 | 864 | ^^^^^^^^^^^^ | 
 | 865 |  | 
 | 866 | .. class:: Treeview | 
 | 867 |  | 
| Georg Brandl | 7f01a13 | 2009-09-16 15:58:14 +0000 | [diff] [blame] | 868 |    .. method:: bbox(item, column=None) | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 869 |  | 
 | 870 |       Returns the bounding box (relative to the treeview widget's window) of | 
 | 871 |       the specified *item* in the form (x, y, width, height). | 
 | 872 |  | 
 | 873 |       If *column* is specified, returns the bounding box of that cell. If the | 
 | 874 |       *item* is not visible (i.e., if it is a descendant of a closed item or is | 
 | 875 |       scrolled offscreen), returns an empty string. | 
 | 876 |  | 
 | 877 |  | 
| Georg Brandl | 7f01a13 | 2009-09-16 15:58:14 +0000 | [diff] [blame] | 878 |    .. method:: get_children(item=None) | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 879 |  | 
 | 880 |       Returns the list of children belonging to *item*. | 
 | 881 |  | 
 | 882 |       If *item* is not specified, returns root children. | 
 | 883 |  | 
 | 884 |  | 
 | 885 |    .. method:: set_children(item, *newchildren) | 
 | 886 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 887 |       Replaces *item*'s child with *newchildren*. | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 888 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 889 |       Children present in *item* that are not present in *newchildren* are | 
 | 890 |       detached from the tree. No items in *newchildren* may be an ancestor of | 
 | 891 |       *item*. Note that not specifying *newchildren* results in detaching | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 892 |       *item*'s children. | 
 | 893 |  | 
 | 894 |  | 
| Georg Brandl | 7f01a13 | 2009-09-16 15:58:14 +0000 | [diff] [blame] | 895 |    .. method:: column(column, option=None, **kw) | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 896 |  | 
 | 897 |       Query or modify the options for the specified *column*. | 
 | 898 |  | 
 | 899 |       If *kw* is not given, returns a dict of the column option values. If | 
 | 900 |       *option* is specified then the value for that *option* is returned. | 
 | 901 |       Otherwise, sets the options to the corresponding values. | 
 | 902 |  | 
 | 903 |       The valid options/values are: | 
 | 904 |  | 
 | 905 |       * id | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 906 |          Returns the column name. This is a read-only option. | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 907 |       * anchor: One of the standard Tk anchor values. | 
 | 908 |          Specifies how the text in this column should be aligned with respect | 
 | 909 |          to the cell. | 
 | 910 |       * minwidth: width | 
 | 911 |          The minimum width of the column in pixels. The treeview widget will | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 912 |          not make the column any smaller than specified by this option when | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 913 |          the widget is resized or the user drags a column. | 
 | 914 |       * stretch: True/False | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 915 |          Specifies whether the column's width should be adjusted when | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 916 |          the widget is resized. | 
 | 917 |       * width: width | 
 | 918 |          The width of the column in pixels. | 
 | 919 |  | 
 | 920 |       To configure the tree column, call this with column = "#0" | 
 | 921 |  | 
 | 922 |    .. method:: delete(*items) | 
 | 923 |  | 
 | 924 |       Delete all specified *items* and all their descendants. | 
 | 925 |  | 
 | 926 |       The root item may not be deleted. | 
 | 927 |  | 
 | 928 |  | 
 | 929 |    .. method:: detach(*items) | 
 | 930 |  | 
 | 931 |       Unlinks all of the specified *items* from the tree. | 
 | 932 |  | 
 | 933 |       The items and all of their descendants are still present, and may be | 
 | 934 |       reinserted at another point in the tree, but will not be displayed. | 
 | 935 |  | 
 | 936 |       The root item may not be detached. | 
 | 937 |  | 
 | 938 |  | 
 | 939 |    .. method:: exists(item) | 
 | 940 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 941 |       Returns True if the specified *item* is present in the tree. | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 942 |  | 
 | 943 |  | 
| Georg Brandl | 7f01a13 | 2009-09-16 15:58:14 +0000 | [diff] [blame] | 944 |    .. method:: focus(item=None) | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 945 |  | 
 | 946 |       If *item* is specified, sets the focus item to *item*. Otherwise, returns | 
 | 947 |       the current focus item, or '' if there is none. | 
 | 948 |  | 
 | 949 |  | 
| Georg Brandl | 7f01a13 | 2009-09-16 15:58:14 +0000 | [diff] [blame] | 950 |    .. method:: heading(column, option=None, **kw) | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 951 |  | 
 | 952 |       Query or modify the heading options for the specified *column*. | 
 | 953 |  | 
 | 954 |       If *kw* is not given, returns a dict of the heading option values. If | 
 | 955 |       *option* is specified then the value for that *option* is returned. | 
 | 956 |       Otherwise, sets the options to the corresponding values. | 
 | 957 |  | 
 | 958 |       The valid options/values are: | 
 | 959 |  | 
 | 960 |       * text: text | 
 | 961 |          The text to display in the column heading. | 
 | 962 |       * image: imageName | 
 | 963 |          Specifies an image to display to the right of the column heading. | 
 | 964 |       * anchor: anchor | 
 | 965 |          Specifies how the heading text should be aligned. One of the standard | 
 | 966 |          Tk anchor values. | 
 | 967 |       * command: callback | 
 | 968 |          A callback to be invoked when the heading label is pressed. | 
 | 969 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 970 |       To configure the tree column heading, call this with column = "#0". | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 971 |  | 
 | 972 |  | 
 | 973 |    .. method:: identify(component, x, y) | 
 | 974 |  | 
 | 975 |       Returns a description of the specified *component* under the point given | 
 | 976 |       by *x* and *y*, or the empty string if no such *component* is present at | 
 | 977 |       that position. | 
 | 978 |  | 
 | 979 |  | 
 | 980 |    .. method:: identify_row(y) | 
 | 981 |  | 
 | 982 |       Returns the item ID of the item at position *y*. | 
 | 983 |  | 
 | 984 |  | 
 | 985 |    .. method:: identify_column(x) | 
 | 986 |  | 
 | 987 |       Returns the data column identifier of the cell at position *x*. | 
 | 988 |  | 
 | 989 |       The tree column has ID #0. | 
 | 990 |  | 
 | 991 |  | 
 | 992 |    .. method:: identify_region(x, y) | 
 | 993 |  | 
 | 994 |       Returns one of: | 
 | 995 |  | 
 | 996 |       +-----------+--------------------------------------+ | 
 | 997 |       | region    | meaning                              | | 
 | 998 |       +===========+======================================+ | 
 | 999 |       | heading   | Tree heading area.                   | | 
 | 1000 |       +-----------+--------------------------------------+ | 
 | 1001 |       | separator | Space between two columns headings.  | | 
 | 1002 |       +-----------+--------------------------------------+ | 
 | 1003 |       | tree      | The tree area.                       | | 
 | 1004 |       +-----------+--------------------------------------+ | 
 | 1005 |       | cell      | A data cell.                         | | 
 | 1006 |       +-----------+--------------------------------------+ | 
 | 1007 |  | 
 | 1008 |       Availability: Tk 8.6. | 
 | 1009 |  | 
 | 1010 |  | 
 | 1011 |    .. method:: identify_element(x, y) | 
 | 1012 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 1013 |       Returns the element at position *x*, *y*. | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1014 |  | 
 | 1015 |       Availability: Tk 8.6. | 
 | 1016 |  | 
 | 1017 |  | 
 | 1018 |    .. method:: index(item) | 
 | 1019 |  | 
 | 1020 |       Returns the integer index of *item* within its parent's list of children. | 
 | 1021 |  | 
 | 1022 |  | 
| Georg Brandl | 7f01a13 | 2009-09-16 15:58:14 +0000 | [diff] [blame] | 1023 |    .. method:: insert(parent, index, iid=None, **kw) | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1024 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 1025 |       Creates a new item and returns the item identifier of the newly created | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1026 |       item. | 
 | 1027 |  | 
 | 1028 |       *parent* is the item ID of the parent item, or the empty string to create | 
 | 1029 |       a new top-level item. *index* is an integer, or the value "end", | 
 | 1030 |       specifying where in the list of parent's children to insert the new item. | 
 | 1031 |       If *index* is less than or equal to zero, the new node is inserted at | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 1032 |       the beginning; if *index* is greater than or equal to the current number | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1033 |       of children, it is inserted at the end. If *iid* is specified, it is used | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 1034 |       as the item identifier; *iid* must not already exist in the tree. | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1035 |       Otherwise, a new unique identifier is generated. | 
 | 1036 |  | 
 | 1037 |       See `Item Options`_ for the list of available points. | 
 | 1038 |  | 
 | 1039 |  | 
| Georg Brandl | 7f01a13 | 2009-09-16 15:58:14 +0000 | [diff] [blame] | 1040 |    .. method:: item(item, option=None, **kw) | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1041 |  | 
 | 1042 |       Query or modify the options for the specified *item*. | 
 | 1043 |  | 
 | 1044 |       If no options are given, a dict with options/values for the item is | 
 | 1045 |       returned. | 
 | 1046 |       If *option* is specified then the value for that option is returned. | 
 | 1047 |       Otherwise, sets the options to the corresponding values as given by *kw*. | 
 | 1048 |  | 
 | 1049 |  | 
 | 1050 |    .. method:: move(item, parent, index) | 
 | 1051 |  | 
 | 1052 |       Moves *item* to position *index* in *parent*'s list of children. | 
 | 1053 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 1054 |       It is illegal to move an item under one of its descendants. If *index* is | 
 | 1055 |       less than or equal to zero, *item* is moved to the beginning; if greater | 
 | 1056 |       than or equal to the number of children, it is moved to the end. If *item* | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1057 |       was detached it is reattached. | 
 | 1058 |  | 
 | 1059 |  | 
 | 1060 |    .. method:: next(item) | 
 | 1061 |  | 
 | 1062 |       Returns the identifier of *item*'s next sibling, or '' if *item* is the | 
 | 1063 |       last child of its parent. | 
 | 1064 |  | 
 | 1065 |  | 
 | 1066 |    .. method:: parent(item) | 
 | 1067 |  | 
 | 1068 |       Returns the ID of the parent of *item*, or '' if *item* is at the top | 
 | 1069 |       level of the hierarchy. | 
 | 1070 |  | 
 | 1071 |  | 
 | 1072 |    .. method:: prev(item) | 
 | 1073 |  | 
 | 1074 |       Returns the identifier of *item*'s previous sibling, or '' if *item* is | 
 | 1075 |       the first child of its parent. | 
 | 1076 |  | 
 | 1077 |  | 
 | 1078 |    .. method:: reattach(item, parent, index) | 
 | 1079 |  | 
 | 1080 |       An alias for :meth:`Treeview.move`. | 
 | 1081 |  | 
 | 1082 |  | 
 | 1083 |    .. method:: see(item) | 
 | 1084 |  | 
 | 1085 |       Ensure that *item* is visible. | 
 | 1086 |  | 
 | 1087 |       Sets all of *item*'s ancestors open option to True, and scrolls the | 
 | 1088 |       widget if necessary so that *item* is within the visible portion of | 
 | 1089 |       the tree. | 
 | 1090 |  | 
 | 1091 |  | 
| Georg Brandl | 7f01a13 | 2009-09-16 15:58:14 +0000 | [diff] [blame] | 1092 |    .. method:: selection(selop=None, items=None) | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1093 |  | 
 | 1094 |       If *selop* is not specified, returns selected items. Otherwise, it will | 
 | 1095 |       act according to the following selection methods. | 
 | 1096 |  | 
 | 1097 |  | 
 | 1098 |    .. method:: selection_set(items) | 
 | 1099 |  | 
 | 1100 |       *items* becomes the new selection. | 
 | 1101 |  | 
 | 1102 |  | 
 | 1103 |    .. method:: selection_add(items) | 
 | 1104 |  | 
 | 1105 |       Add *items* to the selection. | 
 | 1106 |  | 
 | 1107 |  | 
 | 1108 |    .. method:: selection_remove(items) | 
 | 1109 |  | 
 | 1110 |       Remove *items* from the selection. | 
 | 1111 |  | 
 | 1112 |  | 
 | 1113 |    .. method:: selection_toggle(items) | 
 | 1114 |  | 
 | 1115 |       Toggle the selection state of each item in *items*. | 
 | 1116 |  | 
 | 1117 |  | 
| Georg Brandl | 7f01a13 | 2009-09-16 15:58:14 +0000 | [diff] [blame] | 1118 |    .. method:: set(item, column=None, value=None) | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1119 |  | 
 | 1120 |       With one argument, returns a dictionary of column/value pairs for the | 
 | 1121 |       specified *item*. With two arguments, returns the current value of the | 
 | 1122 |       specified *column*. With three arguments, sets the value of given | 
 | 1123 |       *column* in given *item* to the specified *value*. | 
 | 1124 |  | 
 | 1125 |  | 
| Georg Brandl | 7f01a13 | 2009-09-16 15:58:14 +0000 | [diff] [blame] | 1126 |    .. method:: tag_bind(tagname, sequence=None, callback=None) | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1127 |  | 
 | 1128 |       Bind a callback for the given event *sequence* to the tag *tagname*. | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 1129 |       When an event is delivered to an item, the callbacks for each of the | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1130 |       item's tags option are called. | 
 | 1131 |  | 
 | 1132 |  | 
| Georg Brandl | 7f01a13 | 2009-09-16 15:58:14 +0000 | [diff] [blame] | 1133 |    .. method:: tag_configure(tagname, option=None, **kw) | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1134 |  | 
 | 1135 |       Query or modify the options for the specified *tagname*. | 
 | 1136 |  | 
 | 1137 |       If *kw* is not given, returns a dict of the option settings for | 
 | 1138 |       *tagname*. If *option* is specified, returns the value for that *option* | 
 | 1139 |       for the specified *tagname*. Otherwise, sets the options to the | 
 | 1140 |       corresponding values for the given *tagname*. | 
 | 1141 |  | 
 | 1142 |  | 
| Georg Brandl | 7f01a13 | 2009-09-16 15:58:14 +0000 | [diff] [blame] | 1143 |    .. method:: tag_has(tagname, item=None) | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1144 |  | 
 | 1145 |       If *item* is specified, returns 1 or 0 depending on whether the specified | 
 | 1146 |       *item* has the given *tagname*. Otherwise, returns a list of all items | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 1147 |       that have the specified tag. | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1148 |  | 
 | 1149 |       Availability: Tk 8.6 | 
 | 1150 |  | 
 | 1151 |  | 
 | 1152 |    .. method:: xview(*args) | 
 | 1153 |  | 
 | 1154 |       Query or modify horizontal position of the treeview. | 
 | 1155 |  | 
 | 1156 |  | 
 | 1157 |    .. method:: yview(*args) | 
 | 1158 |  | 
 | 1159 |       Query or modify vertical position of the treeview. | 
 | 1160 |  | 
 | 1161 |  | 
 | 1162 | .. _TtkStyling: | 
 | 1163 |  | 
 | 1164 | Ttk Styling | 
 | 1165 | ----------- | 
 | 1166 |  | 
 | 1167 | Each widget in :mod:`ttk` is assigned a style, which specifies the set of | 
 | 1168 | elements making up the widget and how they are arranged, along with dynamic | 
 | 1169 | and default settings for element options. By default the style name is the | 
 | 1170 | same as the widget's class name, but it may be overriden by the widget's style | 
 | 1171 | option. If you don't know the class name of a widget, use the method | 
 | 1172 | :meth:`Misc.winfo_class` (somewidget.winfo_class()). | 
 | 1173 |  | 
 | 1174 | .. seealso:: | 
 | 1175 |  | 
 | 1176 |    `Tcl'2004 conference presentation <http://tktable.sourceforge.net/tile/tile-tcl2004.pdf>`_ | 
 | 1177 |       This document explains how the theme engine works | 
 | 1178 |  | 
 | 1179 |  | 
 | 1180 | .. class:: Style | 
 | 1181 |  | 
 | 1182 |    This class is used to manipulate the style database. | 
 | 1183 |  | 
 | 1184 |  | 
 | 1185 |    .. method:: configure(style, query_opt=None, **kw) | 
 | 1186 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 1187 |       Query or set the default value of the specified option(s) in *style*. | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1188 |  | 
 | 1189 |       Each key in *kw* is an option and each value is a string identifying | 
 | 1190 |       the value for that option. | 
 | 1191 |  | 
 | 1192 |       For example, to change every default button to be a flat button with | 
| Raymond Hettinger | 238018c | 2009-04-08 08:23:44 +0000 | [diff] [blame] | 1193 |       some padding and a different background color:: | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1194 |  | 
 | 1195 |          from tkinter import ttk | 
 | 1196 |          import tkinter | 
 | 1197 |  | 
 | 1198 |          root = tkinter.Tk() | 
 | 1199 |  | 
 | 1200 |          ttk.Style().configure("TButton", padding=6, relief="flat", | 
 | 1201 |             background="#ccc") | 
 | 1202 |  | 
 | 1203 |          btn = ttk.Button(text="Sample") | 
 | 1204 |          btn.pack() | 
 | 1205 |  | 
 | 1206 |          root.mainloop() | 
 | 1207 |  | 
 | 1208 |  | 
 | 1209 |    .. method:: map(style, query_opt=None, **kw) | 
 | 1210 |  | 
 | 1211 |       Query or sets dynamic values of the specified option(s) in *style*. | 
 | 1212 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 1213 |       Each key in *kw* is an option and each value should be a list or a | 
 | 1214 |       tuple (usually) containing statespecs grouped in tuples, lists, or | 
| Raymond Hettinger | 238018c | 2009-04-08 08:23:44 +0000 | [diff] [blame] | 1215 |       some other preference. A statespec is a compound of one | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 1216 |       or more states and then a value. | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1217 |  | 
 | 1218 |       An example may make it more understandable:: | 
 | 1219 |  | 
 | 1220 |          import tkinter | 
 | 1221 |          from tkinter import ttk | 
 | 1222 |  | 
 | 1223 |          root = tkinter.Tk() | 
 | 1224 |  | 
 | 1225 |          style = ttk.Style() | 
 | 1226 |          style.map("C.TButton", | 
 | 1227 |              foreground=[('pressed', 'red'), ('active', 'blue')], | 
 | 1228 |              background=[('pressed', '!disabled', 'black'), ('active', 'white')] | 
 | 1229 |              ) | 
 | 1230 |  | 
 | 1231 |          colored_btn = ttk.Button(text="Test", style="C.TButton").pack() | 
 | 1232 |  | 
 | 1233 |          root.mainloop() | 
 | 1234 |  | 
 | 1235 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 1236 |       Note that the order of the (states, value) sequences for an option does | 
| Raymond Hettinger | 238018c | 2009-04-08 08:23:44 +0000 | [diff] [blame] | 1237 |       matter, if the order is changed to ``[('active', 'blue'), ('pressed', | 
 | 1238 |       'red')]`` in the foreground option, for example, the result would be a | 
 | 1239 |       blue foreground when the widget were in active or pressed states. | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1240 |  | 
 | 1241 |  | 
| Georg Brandl | 7f01a13 | 2009-09-16 15:58:14 +0000 | [diff] [blame] | 1242 |    .. method:: lookup(style, option, state=None, default=None) | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1243 |  | 
 | 1244 |       Returns the value specified for *option* in *style*. | 
 | 1245 |  | 
 | 1246 |       If *state* is specified, it is expected to be a sequence of one or more | 
 | 1247 |       states. If the *default* argument is set, it is used as a fallback value | 
 | 1248 |       in case no specification for option is found. | 
 | 1249 |  | 
| Raymond Hettinger | 238018c | 2009-04-08 08:23:44 +0000 | [diff] [blame] | 1250 |       To check what font a Button uses by default:: | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1251 |  | 
 | 1252 |          from tkinter import ttk | 
 | 1253 |  | 
| Ezio Melotti | 985e24d | 2009-09-13 07:54:02 +0000 | [diff] [blame] | 1254 |          print(ttk.Style().lookup("TButton", "font")) | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1255 |  | 
 | 1256 |  | 
| Georg Brandl | 7f01a13 | 2009-09-16 15:58:14 +0000 | [diff] [blame] | 1257 |    .. method:: layout(style, layoutspec=None) | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1258 |  | 
 | 1259 |       Define the widget layout for given *style*. If *layoutspec* is omitted, | 
 | 1260 |       return the layout specification for given style. | 
 | 1261 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 1262 |       *layoutspec*, if specified, is expected to be a list or some other | 
 | 1263 |       sequence type (excluding strings), where each item should be a tuple and | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1264 |       the first item is the layout name and the second item should have the | 
| Ezio Melotti | e130a52 | 2011-10-19 10:58:56 +0300 | [diff] [blame] | 1265 |       format described in `Layouts`_. | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1266 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 1267 |       To understand the format, see the following example (it is not | 
 | 1268 |       intended to do anything useful):: | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1269 |  | 
 | 1270 |          from tkinter import ttk | 
 | 1271 |          import tkinter | 
 | 1272 |  | 
 | 1273 |          root = tkinter.Tk() | 
 | 1274 |  | 
 | 1275 |          style = ttk.Style() | 
 | 1276 |          style.layout("TMenubutton", [ | 
 | 1277 |             ("Menubutton.background", None), | 
 | 1278 |             ("Menubutton.button", {"children": | 
 | 1279 |                 [("Menubutton.focus", {"children": | 
 | 1280 |                     [("Menubutton.padding", {"children": | 
 | 1281 |                         [("Menubutton.label", {"side": "left", "expand": 1})] | 
 | 1282 |                     })] | 
 | 1283 |                 })] | 
 | 1284 |             }), | 
 | 1285 |          ]) | 
 | 1286 |  | 
 | 1287 |          mbtn = ttk.Menubutton(text='Text') | 
 | 1288 |          mbtn.pack() | 
 | 1289 |          root.mainloop() | 
 | 1290 |  | 
 | 1291 |  | 
 | 1292 |    .. method:: element_create(elementname, etype, *args, **kw) | 
 | 1293 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 1294 |       Create a new element in the current theme, of the given *etype* which is | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1295 |       expected to be either "image", "from" or "vsapi". The latter is only | 
 | 1296 |       available in Tk 8.6a for Windows XP and Vista and is not described here. | 
 | 1297 |  | 
 | 1298 |       If "image" is used, *args* should contain the default image name followed | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 1299 |       by statespec/value pairs (this is the imagespec), and *kw* may have the | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1300 |       following options: | 
 | 1301 |  | 
 | 1302 |        * border=padding | 
 | 1303 |           padding is a list of up to four integers, specifying the left, top, | 
 | 1304 |           right, and bottom borders, respectively. | 
 | 1305 |  | 
 | 1306 |        * height=height | 
 | 1307 |           Specifies a minimum height for the element. If less than zero, the | 
 | 1308 |           base image's height is used as a default. | 
 | 1309 |  | 
 | 1310 |        * padding=padding | 
 | 1311 |           Specifies the element's interior padding. Defaults to border's value | 
 | 1312 |           if not specified. | 
 | 1313 |  | 
 | 1314 |        * sticky=spec | 
 | 1315 |           Specifies how the image is placed within the final parcel. spec | 
| Sandro Tosi | 2b373b0 | 2011-12-25 17:07:22 +0100 | [diff] [blame] | 1316 |           contains zero or more characters "n", "s", "w", or "e". | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1317 |  | 
 | 1318 |        * width=width | 
 | 1319 |           Specifies a minimum width for the element. If less than zero, the | 
 | 1320 |           base image's width is used as a default. | 
 | 1321 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 1322 |       If "from" is used as the value of *etype*, | 
 | 1323 |       :meth:`element_create` will clone an existing | 
 | 1324 |       element. *args* is expected to contain a themename, from which | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1325 |       the element will be cloned, and optionally an element to clone from. | 
 | 1326 |       If this element to clone from is not specified, an empty element will | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 1327 |       be used. *kw* is discarded. | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1328 |  | 
 | 1329 |  | 
 | 1330 |    .. method:: element_names() | 
 | 1331 |  | 
 | 1332 |       Returns the list of elements defined in the current theme. | 
 | 1333 |  | 
 | 1334 |  | 
 | 1335 |    .. method:: element_options(elementname) | 
 | 1336 |  | 
 | 1337 |       Returns the list of *elementname*'s options. | 
 | 1338 |  | 
 | 1339 |  | 
| Georg Brandl | 7f01a13 | 2009-09-16 15:58:14 +0000 | [diff] [blame] | 1340 |    .. method:: theme_create(themename, parent=None, settings=None) | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1341 |  | 
 | 1342 |       Create a new theme. | 
 | 1343 |  | 
 | 1344 |       It is an error if *themename* already exists. If *parent* is specified, | 
 | 1345 |       the new theme will inherit styles, elements and layouts from the parent | 
 | 1346 |       theme. If *settings* are present they are expected to have the same | 
 | 1347 |       syntax used for :meth:`theme_settings`. | 
 | 1348 |  | 
 | 1349 |  | 
 | 1350 |    .. method:: theme_settings(themename, settings) | 
 | 1351 |  | 
 | 1352 |       Temporarily sets the current theme to *themename*, apply specified | 
 | 1353 |       *settings* and then restore the previous theme. | 
 | 1354 |  | 
 | 1355 |       Each key in *settings* is a style and each value may contain the keys | 
 | 1356 |       'configure', 'map', 'layout' and 'element create' and they are expected | 
 | 1357 |       to have the same format as specified by the methods | 
 | 1358 |       :meth:`Style.configure`, :meth:`Style.map`, :meth:`Style.layout` and | 
 | 1359 |       :meth:`Style.element_create` respectively. | 
 | 1360 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 1361 |       As an example, let's change the Combobox for the default theme a bit:: | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1362 |  | 
 | 1363 |          from tkinter import ttk | 
 | 1364 |          import tkinter | 
 | 1365 |  | 
 | 1366 |          root = tkinter.Tk() | 
 | 1367 |  | 
 | 1368 |          style = ttk.Style() | 
 | 1369 |          style.theme_settings("default", { | 
 | 1370 |             "TCombobox": { | 
 | 1371 |                 "configure": {"padding": 5}, | 
 | 1372 |                 "map": { | 
 | 1373 |                     "background": [("active", "green2"), | 
 | 1374 |                                    ("!disabled", "green4")], | 
 | 1375 |                     "fieldbackground": [("!disabled", "green3")], | 
 | 1376 |                     "foreground": [("focus", "OliveDrab1"), | 
 | 1377 |                                    ("!disabled", "OliveDrab2")] | 
 | 1378 |                 } | 
 | 1379 |             } | 
 | 1380 |          }) | 
 | 1381 |  | 
 | 1382 |          combo = ttk.Combobox().pack() | 
 | 1383 |  | 
 | 1384 |          root.mainloop() | 
 | 1385 |  | 
 | 1386 |  | 
 | 1387 |    .. method:: theme_names() | 
 | 1388 |  | 
 | 1389 |       Returns a list of all known themes. | 
 | 1390 |  | 
 | 1391 |  | 
| Georg Brandl | 7f01a13 | 2009-09-16 15:58:14 +0000 | [diff] [blame] | 1392 |    .. method:: theme_use(themename=None) | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1393 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 1394 |       If *themename* is not given, returns the theme in use.  Otherwise, sets | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1395 |       the current theme to *themename*, refreshes all widgets and emits a | 
 | 1396 |       <<ThemeChanged>> event. | 
 | 1397 |  | 
 | 1398 |  | 
 | 1399 | Layouts | 
 | 1400 | ^^^^^^^ | 
 | 1401 |  | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 1402 | A layout can be just None, if it takes no options, or a dict of | 
 | 1403 | options specifying how to arrange the element. The layout mechanism | 
 | 1404 | uses a simplified version of the pack geometry manager: given an | 
 | 1405 | initial cavity, each element is allocated a parcel. Valid | 
 | 1406 | options/values are: | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1407 |  | 
 | 1408 |  * side: whichside | 
| Benjamin Peterson | d23f822 | 2009-04-05 19:13:16 +0000 | [diff] [blame] | 1409 |     Specifies which side of the cavity to place the element; one of | 
| Guilherme Polo | 5f23848 | 2009-01-28 14:41:10 +0000 | [diff] [blame] | 1410 |     top, right, bottom or left. If omitted, the element occupies the | 
 | 1411 |     entire cavity. | 
 | 1412 |  | 
 | 1413 |  * sticky: nswe | 
 | 1414 |     Specifies where the element is placed inside its allocated parcel. | 
 | 1415 |  | 
 | 1416 |  * unit: 0 or 1 | 
 | 1417 |     If set to 1, causes the element and all of its descendants to be treated as | 
 | 1418 |     a single element for the purposes of :meth:`Widget.identify` et al. It's | 
 | 1419 |     used for things like scrollbar thumbs with grips. | 
 | 1420 |  | 
 | 1421 |  * children: [sublayout... ] | 
 | 1422 |     Specifies a list of elements to place inside the element. Each | 
 | 1423 |     element is a tuple (or other sequence type) where the first item is | 
 | 1424 |     the layout name, and the other is a `Layout`_. | 
 | 1425 |  | 
 | 1426 | .. _Layout: `Layouts`_ |