• Home
  • Raw
  • Download

Lines Matching refs:the

11 The :mod:`ttk` module provides access to the Tk themed widget set, which has
14 provided by the new Tk, like anti-aliased font rendering under X11, window
18 The basic idea of :mod:`ttk` is to separate, to the extent possible, the code
19 implementing a widget's behavior from the code implementing its appearance.
47 and :class:`Scrollbar`) will automatically substitute for the Tk widgets.
49 This has the direct benefit of using the new widgets, giving better look & feel
53 achieve the same (or better) styling.
57 …`Converting existing applications to use the Tile widgets <http://tktable.sourceforge.net/tile/doc…
59 converting applications to use the new widgets.
74 As said previously, you will notice changes in look-and-feel as well in the
75 styling code. To demonstrate the latter, a very simple example is shown below.
91 For more information about TtkStyling_ read the :class:`Style` class
104 All the :mod:`ttk` widgets accept the following options:
109 | class | Specifies the window class. The class is used when querying |
110 | | the option database for the window's other options, to |
111 | | determine the default bindtags for the window, and to select |
112 | | the widget's default layout and style. This is a read-only |
113 | | option which may only be specified when the window is |
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 | | from the parent widget. |
120 | takefocus | Determines whether the window accepts the focus during |
122 | | If 0, the window should be skipped entirely |
123 | | during keyboard traversal. If 1, the window |
124 | | should receive the input focus as long as it is viewable. |
125 | | An empty string means that the traversal scripts make the |
126 | | decision about whether or not to focus on the window. |
143 | | When the view in the widget's window changes, the widget|
144 | | will generate a Tcl command based on the scrollcommand. |
146 | | Usually this option consists of the |
149 | | the scrollbar to be updated whenever the view in the |
169 | text | Specifies a text string to be displayed inside the widget.|
171 | textvariable | Specifies a name whose value will be used in place of the |
174 | underline | If set, specifies the index (0-based) of a character to |
175 | | underline in the text string. The underline character is |
179 | | elements. The first element is the default image name. The|
180 | | rest of the list is a sequence of statespec/value pairs as|
182 | | to use when the widget is in a particular state or a |
183 | | combination of states. All images in the list should have |
184 | | the same size. |
186 | compound | Specifies how to display the image relative to the text, |
187 | | in the case both text and image options are present. |
193 | | left of, or right of the text, respectively. |
194 | | * none: the default. display the image if present, |
195 | | otherwise the text. |
198 | | character widths, to allocate for the text label; if less |
200 | | unspecified, the natural width of the text label is used. |
210 | state | May be set to "normal" or "disabled" to control the "disabled" |
211 | | state bit. This is a write-only option: setting it changes the |
212 | | widget state, but the :meth:`Widget.state` method does not |
224 | active | The mouse cursor is over the widget and pressing a mouse |
238 | | background window, and cleared for those in the foreground |
249 an exclamation point indicating that the bit is off.
255 Besides the methods described below, the :class:`ttk.Widget` class supports the
262 Returns the name of the element at position *x* *y*, or the empty string
263 if the point does not lie within any element.
265 *x* and *y* are pixel coordinates relative to the widget.
270 Test the widget's state. If a callback is not specified, returns ``True``
271 if the widget state matches *statespec* and ``False`` otherwise. If callback
278 Modify or read widget state. If *statespec* is specified, sets the
281 the currently-enabled state flags.
292 Besides the methods inherited from :class:`Widget` (:meth:`Widget.cget`,
304 This widget accepts the following options:
309 | exportselection | Boolean value. If set, the widget selection is linked |
310 | | to the Window Manager selection (which can be returned |
313 | justify | Specifies how the text is aligned within the widget. |
316 | height | Specifies the height of the pop-down listbox, in rows. |
320 | | is called immediately before displaying the values. It |
323 | state | One of "normal", "readonly", or "disabled". In the |
324 | | "readonly" state, the value may not be edited directly,|
325 | | and the user can only select one of the values from the|
326 | | dropdown list. In the "normal" state, the text field is|
327 | | directly editable. In the "disabled" state, no |
330 | textvariable | Specifies a name whose value is linked to the widget |
331 | | value. Whenever the value associated with that name |
332 | | changes, the widget value is updated, and vice versa. |
335 | values | Specifies the list of values to display in the |
338 | width | Specifies an integer value indicating the desired width|
339 | | of the entry window, in average-size characters of the |
348 when the user selects an element from the list of values.
358 If *newindex* is specified, sets the combobox value to the element
359 position *newindex*. Otherwise, returns the index of the current value or
360 -1 if the current value is not in the values list.
365 Returns the current value of the combobox.
370 Sets the value of the combobox to *value*.
377 one at a time. Each child window is associated with a tab, which the user
378 may select to change the currently-displayed window.
384 This widget accepts the following specific options:
389 | height | If present and greater than zero, specifies the desired height |
390 | | of the pane area (not including internal padding or tabs). |
391 | | Otherwise, the maximum height of all panes is used. |
393 | padding | Specifies the amount of extra space to add around the outside |
394 | | of the notebook. The padding is a list of up to four length |
399 | width | If present and greater than zero, specifies the desired width |
400 | | of the pane area (not including internal padding). Otherwise, |
401 | | the maximum width of all panes is used. |
414 | | the tab is not selectable. If "hidden", then the tab is not |
417 | sticky | Specifies how the child window is positioned within the pane |
418 | | area. Value is a string containing zero or more of the |
420 | | side (north, south, east or west) that the child window will |
421 | | stick to, as per the :meth:`grid` geometry manager. |
423 | padding | Specifies the amount of extra space to add between the |
424 | | notebook and this pane. Syntax is the same as for the option |
427 | text | Specifies a text to be displayed in the tab. |
429 | image | Specifies an image to display in the tab. See the option |
432 | compound | Specifies how to display the image relative to the text, in |
433 | | the case both text and image options are present. See |
436 | underline | Specifies the index (0-based) of a character to underline in |
437 | | the text string. The underlined character is used for |
447 of the following forms:
449 * An integer between zero and the number of tabs.
451 * A positional specification of the form "@x,y", which identifies the tab.
452 * The literal string "current", which identifies the currently-selected tab.
453 * The literal string "end", which returns the number of tabs (only valid for
471 Adds a new tab to the notebook.
473 If window is currently managed by the notebook but hidden, it is
476 See `Tab Options`_ for the list of available options.
481 Removes the tab specified by *tab_id*, unmaps and unmanages the
487 Hides the tab specified by *tab_id*.
489 The tab will not be displayed, but the associated window remains
490 managed by the notebook and its configuration remembered. Hidden tabs
491 may be restored with the :meth:`add` command.
496 Returns the name of the tab element at position *x*, *y*, or the empty
502 Returns the numeric index of the tab specified by *tab_id*, or the total
503 number of tabs if *tab_id* is the string "end".
508 Inserts a pane at the specified position.
510 *pos* is either the string "end", an integer index, or the name of a
511 managed child. If *child* is already managed by the notebook, moves it to
512 the specified position.
514 See `Tab Options`_ for the list of available options.
519 Selects the specified *tab_id*.
521 The associated child window will be displayed, and the
523 omitted, returns the widget name of the currently selected pane.
528 Query or modify the options of the specific *tab_id*.
530 If *kw* is not given, returns a dictionary of the tab option values. If
531 *option* is specified, returns the value of that *option*. Otherwise,
532 sets the options to the corresponding values.
537 Returns a list of windows managed by the notebook.
544 This will extend the bindings for the toplevel window containing the
547 * :kbd:`Control-Tab`: selects the tab following the currently selected one.
548 * :kbd:`Shift-Control-Tab`: selects the tab preceding the currently selected one.
549 * :kbd:`Alt-K`: where *K* is the mnemonic (underlined) character of any tab, will
554 properly if all panes have the notebook they are in as master.
560 The :class:`ttk.Progressbar` widget shows the status of a long-running
561 operation. It can operate in two modes: determinate mode shows the amount
562 completed relative to the total amount of work to be done, and indeterminate
563 mode provides an animated display to let the user know that something is
570 This widget accepts the following specific options:
575 | orient | One of "horizontal" or "vertical". Specifies the orientation |
576 | | of the progress bar. |
578 | length | Specifies the length of the long axis of the progress bar |
583 | maximum | A number specifying the maximum value. Defaults to 100. |
585 | value | The current value of the progress bar. In "determinate" mode, |
586 | | this represents the amount of work completed. In |
588 | | that is, the progress bar completes one "cycle" when its value|
591 | variable | A name which is linked to the option value. If specified, the |
592 | | value of the progress bar is automatically set to the value of|
593 | | this name whenever the latter is modified. |
595 | phase | Read-only option. The widget periodically increments the value|
598 | | by the current theme to provide additional animation effects. |
616 Increments the progress bar's value by *amount*.
633 It has no other methods besides the ones inherited from :class:`ttk.Widget`.
639 This widget accepts the following specific option:
644 | orient | One of "horizontal" or "vertical". Specifies the orientation of|
645 | | the separator. |
652 The :class:`ttk.Sizegrip` widget (also known as a grow box) allows the user to
653 resize the containing toplevel window by pressing and dragging the grip.
655 This widget has neither specific options nor specific methods, besides the
663 by default. Adding a :class:`Sizegrip` is harmless, since the built-in
664 grip will just mask the widget.
670 * If the containing toplevel's position was specified relative to the right
671 or bottom of the screen (e.g. ....), the :class:`Sizegrip` widget will
672 not resize the window.
681 values. The data values are displayed in successive columns after the tree
685 the widget option ``displaycolumns``. The tree widget can also display column
686 headings. Columns may be accessed by number or symbolic names listed in the
690 if they are not supplied by the caller. There is a distinguished root item,
691 named ``{}``. The root item itself is not displayed; its children appear at the
692 top level of the hierarchy.
695 with individual items and control the appearance of the item.
698 the options described in `Scrollable Widget Options`_ and the methods
705 This widget accepts the following specific options:
713 | columns | A list of column identifiers, specifying the number of |
718 | | displayed and the order in which they appear, or the |
721 | height | Specifies the number of rows which should be visible. |
722 | | Note: the requested width is determined from the sum |
723 | | of the column widths. |
725 | padding | Specifies the internal padding for the widget. The |
728 | selectmode | Controls how the built-in class bindings manage the |
730 | | If set to "extended" (the default), multiple items may |
732 | | selected at a time. If "none", the selection will not |
735 | | Note that the application code and tag bindings can set|
736 | | the selection however they wish, regardless of the |
739 | show | A list containing zero or more of the following values,|
740 | | specifying which elements of the tree to display. |
743 | | * headings: display the heading row. |
748 | | **Note**: Column #0 always refers to the tree column, |
756 The following item options may be specified for items in the insert and item
762 | text | The textual label to display for the item. |
764 | image | A Tk Image, displayed to the left of the label. |
766 | values | The list of values associated with the item. |
768 | | Each item should have the same number of values as the widget |
769 | | option columns. If there are fewer values than columns, the |
771 | | than columns, the extra values are ignored. |
773 | open | True/False value indicating whether the item's children should|
788 | foreground | Specifies the text foreground color. |
790 | background | Specifies the cell or item background color. |
792 | font | Specifies the font to use when drawing text. |
794 | image | Specifies the item image, in case the item's image option |
802 Column identifiers take any of the following forms:
804 * A symbolic name from the list of columns option.
805 * An integer n, specifying the nth data column.
806 * A string of the form #n, where n is an integer, specifying the nth display
811 * Item's option values may be displayed in a different order than the order
813 * Column #0 always refers to the tree column, even if show="tree" is not
817 column number is the column number in the tree where the values are displayed.
820 refers to the tree column**.
826 The Treeview widget generates the following virtual events.
831 | <<TreeviewSelect>> | Generated whenever the selection changes. |
833 | <<TreeviewOpen>> | Generated just before settings the focus item to |
836 | <<TreeviewClose>> | Generated just after setting the focus item to |
841 to determine the affected item or items.
851 Returns the bounding box (relative to the treeview widget's window) of
852 the specified *item* in the form (x, y, width, height).
854 If *column* is specified, returns the bounding box of that cell. If the
861 Returns the list of children belonging to *item*.
871 detached from the tree. No items in *newchildren* may be an ancestor of
878 Query or modify the options for the specified *column*.
880 If *kw* is not given, returns a dict of the column option values. If
881 *option* is specified then the value for that *option* is returned.
882 Otherwise, sets the options to the corresponding values.
887 Returns the column name. This is a read-only option.
888 * anchor: One of the standard Tk anchor values.
889 Specifies how the text in this column should be aligned with respect
890 to the cell.
892 The minimum width of the column in pixels. The treeview widget will
893 not make the column any smaller than specified by this option when
894 the widget is resized or the user drags a column.
896 Specifies whether the column's width should be adjusted when
897 the widget is resized.
899 The width of the column in pixels.
901 To configure the tree column, call this with column = "#0"
912 Unlinks all of the specified *items* from the tree.
915 reinserted at another point in the tree, but will not be displayed.
922 Returns ``True`` if the specified *item* is present in the tree.
927 If *item* is specified, sets the focus item to *item*. Otherwise, returns
928 the current focus item, or '' if there is none.
933 Query or modify the heading options for the specified *column*.
935 If *kw* is not given, returns a dict of the heading option values. If
936 *option* is specified then the value for that *option* is returned.
937 Otherwise, sets the options to the corresponding values.
942 The text to display in the column heading.
944 Specifies an image to display to the right of the column heading.
946 Specifies how the heading text should be aligned. One of the standard
949 A callback to be invoked when the heading label is pressed.
951 To configure the tree column heading, call this with column = "#0".
956 Returns a description of the specified *component* under the point given
957 by *x* and *y*, or the empty string if no such *component* is present at
963 Returns the item ID of the item at position *y*.
968 Returns the data column identifier of the cell at position *x*.
994 Returns the element at position *x*, *y*.
1001 Returns the integer index of *item* within its parent's list of children.
1006 Creates a new item and returns the item identifier of the newly created
1009 *parent* is the item ID of the parent item, or the empty string to create
1010 a new top-level item. *index* is an integer, or the value "end",
1011 specifying where in the list of parent's children to insert the new item.
1012 If *index* is less than or equal to zero, the new node is inserted at
1013 the beginning; if *index* is greater than or equal to the current number
1014 of children, it is inserted at the end. If *iid* is specified, it is used
1015 as the item identifier; *iid* must not already exist in the tree.
1018 See `Item Options`_ for the list of available points.
1023 Query or modify the options for the specified *item*.
1025 If no options are given, a dict with options/values for the item is
1027 If *option* is specified then the value for that option is returned.
1028 Otherwise, sets the options to the corresponding values as given by *kw*.
1036 less than or equal to zero, *item* is moved to the beginning; if greater
1037 than or equal to the number of children, it is moved to the end. If *item*
1043 Returns the identifier of *item*'s next sibling, or '' if *item* is the
1049 Returns the ID of the parent of *item*, or '' if *item* is at the top
1050 level of the hierarchy.
1055 Returns the identifier of *item*'s previous sibling, or '' if *item* is
1056 the first child of its parent.
1068 Sets all of *item*'s ancestors open option to ``True``, and scrolls the
1069 widget if necessary so that *item* is within the visible portion of
1070 the tree.
1076 act according to the following selection methods.
1081 *items* becomes the new selection.
1086 Add *items* to the selection.
1091 Remove *items* from the selection.
1096 Toggle the selection state of each item in *items*.
1101 With one argument, returns a dictionary of column/value pairs for the
1102 specified *item*. With two arguments, returns the current value of the
1103 specified *column*. With three arguments, sets the value of given
1104 *column* in given *item* to the specified *value*.
1109 Bind a callback for the given event *sequence* to the tag *tagname*.
1110 When an event is delivered to an item, the callbacks for each of the
1116 Query or modify the options for the specified *tagname*.
1118 If *kw* is not given, returns a dict of the option settings for
1119 *tagname*. If *option* is specified, returns the value for that *option*
1120 for the specified *tagname*. Otherwise, sets the options to the
1121 corresponding values for the given *tagname*.
1126 If *item* is specified, returns 1 or 0 depending on whether the specified
1127 *item* has the given *tagname*. Otherwise, returns a list of all items
1128 that have the specified tag.
1135 Query or modify horizontal position of the treeview.
1140 Query or modify vertical position of the treeview.
1148 Each widget in :mod:`ttk` is assigned a style, which specifies the set of
1149 elements making up the widget and how they are arranged, along with dynamic and
1150 default settings for element options. By default the style name is the same as
1151 the widget's class name, but it may be overridden by the widget's style
1152 option. If the class name of a widget is unknown, use the method
1158 This document explains how the theme engine works
1163 This class is used to manipulate the style database.
1168 Query or set the default value of the specified option(s) in *style*.
1171 the value for that option.
1192 Query or sets dynamic values of the specified option(s) in *style*.
1217 Note that the order of the (states, value) sequences for an
1218 option matters. In the previous example, if you change the
1219 order to ``[('active', 'blue'), ('pressed', 'red')]`` in the
1221 when the widget is in the active or pressed states.
1225 Returns the value specified for *option* in *style*.
1228 states. If the *default* argument is set, it is used as a fallback value
1240 Define the widget layout for given *style*. If *layoutspec* is omitted,
1241 return the layout specification for given style.
1245 the first item is the layout name and the second item should have the
1248 To understand the format, see the following example (it is not
1275 Create a new element in the current theme, of the given *etype* which is
1279 If "image" is used, *args* should contain the default image name followed
1280 by statespec/value pairs (this is the imagespec), and *kw* may have the
1284 padding is a list of up to four integers, specifying the left, top,
1288 Specifies a minimum height for the element. If less than zero, the
1292 Specifies the element's interior padding. Defaults to border's value
1296 Specifies how the image is placed within the final parcel. spec
1300 Specifies a minimum width for the element. If less than zero, the
1303 If "from" is used as the value of *etype*,
1306 the element will be cloned, and optionally an element to clone from.
1313 Returns the list of elements defined in the current theme.
1318 Returns the list of *elementname*'s options.
1326 the new theme will inherit styles, elements and layouts from the parent
1327 theme. If *settings* are present they are expected to have the same
1333 Temporarily sets the current theme to *themename*, apply specified
1334 *settings* and then restore the previous theme.
1336 Each key in *settings* is a style and each value may contain the keys
1338 to have the same format as specified by the methods
1342 As an example, let's change the Combobox for the default theme a bit::
1375 If *themename* is not given, returns the theme in use. Otherwise, sets
1376 the current theme to *themename*, refreshes all widgets and emits a
1384 options specifying how to arrange the element. The layout mechanism
1385 uses a simplified version of the pack geometry manager: given an
1390 Specifies which side of the cavity to place the element; one of
1391 top, right, bottom or left. If omitted, the element occupies the
1395 Specifies where the element is placed inside its allocated parcel.
1398 If set to 1, causes the element and all of its descendants to be treated as
1399 a single element for the purposes of :meth:`Widget.identify` et al. It's
1403 Specifies a list of elements to place inside the element. Each
1404 element is a tuple (or other sequence type) where the first item is
1405 the layout name, and the other is a `Layout`_.