[Python-checkins] r63185 - sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst

guilherme.polo python-checkins at python.org
Mon May 12 21:32:41 CEST 2008


Author: guilherme.polo
Date: Mon May 12 21:32:41 2008
New Revision: 63185

Log:
Started Treeview documentation, missing class documentation.

Modified:
   sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst

Modified: sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst
==============================================================================
--- sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst	(original)
+++ sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst	Mon May 12 21:32:41 2008
@@ -649,6 +649,166 @@
 Treeview
 --------
 
+Ttk Treeview widget displays a hierarchical collection of items. Each item has 
+a textual label, an optional image, and an optional list of data values. The 
+data values are displayed in successive columns after the tree label.
+
+The order in which data values are displayed may be controlled by setting
+the widget option displaycolumns. The tree widget can also display column
+headings. Columns may be accessed by number or symbolic names listed in the
+widget option columns. See `Column Identifiers`_.
+
+Each item is identified by an unique name. The widget will generate item IDs
+if they are not supplied by the caller. There is a distinguished root item,
+name {}. The root item itself is not displayed; its children appear at the
+top level of the hierarchy.
+
+Each item also has a list of tags, which can be used to associate even bindings
+with individual items and control the appearance of the item.
+
+The Treeview widget supports horizontal and vertical scrolling, according to
+the options described in `Scrollable Widget Options`_ and the methods
+:meth:`Treeview.xview` and :meth:`Treeview.yview`.
+
+
+Options
+^^^^^^^
+
+This widget accepts the following specific option:
+
+   +----------------+--------------------------------------------------------+
+   | option         | description                                            |
+   +================+========================================================|
+   | column         | A list of column identifiers, specifying the number of |
+   |                | columns and their names.                               |
+   +----------------+--------------------------------------------------------+
+   | displaycolumns | A list of column identifiers (either symbolic or       |
+   |                | integer indices) specifying which data columns are     |
+   |                | displayed and the order in which they appear, or the   |
+   |                | string "#all".                                         |
+   +----------------+--------------------------------------------------------+
+   | height         | Specifies the number of rows which should be visible.  |
+   |                | Note: the requested width is determined from the sum   |
+   |                | of the column widths.                                  |
+   +----------------+--------------------------------------------------------+
+   | padding        | Specifies the internal padding for the widget. The     |
+   |                | padding is a list of up to four length specifications. |
+   +----------------+--------------------------------------------------------+
+   | selectmode     | Controls how the built-in class bindings manage the    |
+   |                | selection. One of "extended", "browse" or "none".      |
+   |                | If set to "extended" (the default), multiple items may |
+   |                | be selected. If "browse", only a single item will be   |
+   |                | selected at a time. If "none", the selection will not  |
+   |                | be changed.                                            |
+   |                |                                                        |
+   |                | Note that the application code and tag bindings can set|
+   |                | the selection however they wish, regardless the value  |
+   |                | of this option.                                        |
+   +----------------+--------------------------------------------------------+
+   | show           | A list containing zero or more of the following values,|
+   |                | specifying which elements of the tree to display.      |
+   |                |                                                        |
+   |                | * tree: display tree labels in column #0.              |
+   |                | * headings: display the heading row.                   |
+   |                |                                                        |
+   |                | The default is "tree headings", i.e., show all         |
+   |                | elements.                                              |
+   |                |                                                        |
+   |                | **Note**: Column #0 always refer to the tree column,   |
+   |                | even if show="tree" is not specified.                  |
+   +----------------+--------------------------------------------------------+
+
+
+Item Options
+^^^^^^^^^^^^
+
+The following item options may be specified for items in the insert and item 
+widget commands. 
+
+   +--------+---------------------------------------------------------------+
+   | option | description                                                   |
+   +========+===============================================================+
+   | text   | The textual label to display for the item.                    |
+   +--------+---------------------------------------------------------------+
+   | image  | A Tk Image, displayed to the left of the label.               |
+   +--------+---------------------------------------------------------------+
+   | values | The list of values associated with the item.                  |
+   |        |                                                               |
+   |        | Each item should have the same number of values as the widget |
+   |        | option columns. If there are fewer values than columns, the   |
+   |        | remaining values are assumed empty. If there are more values  |
+   |        | than columns, the extra values are ignored.                   |
+   +--------+---------------------------------------------------------------+
+   | open   | True/False value indicating wheter the item's children should |
+   |        | be displayed or hidden.                                       |
+   +--------+---------------------------------------------------------------+
+   | tags   | A list of tags associated with this item.                     |
+   +--------+---------------------------------------------------------------+
+
+
+Tag Options
+^^^^^^^^^^^
+
+The following options may be specified on tags: 
+
+   +------------+-----------------------------------------------------------+
+   | option     | description                                               |
+   +============+===========================================================+
+   | foreground | Specifies the text foreground color.                      |
+   +------------+-----------------------------------------------------------+
+   | background | Specifies the cell or item background color.              |
+   +------------+-----------------------------------------------------------+
+   | font       | Specifies the font to use when drawing text.              |
+   +------------+-----------------------------------------------------------+
+   | image      | Specifies the item image, in case the item's image option |
+   |            | is empty.                                                 |
+   +------------+-----------------------------------------------------------+
+
+
+Column Identifiers
+^^^^^^^^^^^^^^^^^^
+
+Column identifiers take any of the following forms: 
+
+* A symbolic name from the list of columns option.
+* An integer n, specifying the nth data column.
+* A string of the form #n, where n is an integer, specifying the nth display
+  column.
+
+Notes:
+
+* Item's option values may be displayed in a different order than the order
+  in which they are stored.
+* Column #0 always refers to the tree column, even if show="tree" is not
+  specified.
+
+A data column number is an index into an item's option values list; a display
+column number is the column number in the tree where the values are displayed.
+Tree labels are displayed in column #0. If option displaycolumns is not set,
+then data column n is displayed in column #n+1. Again, **column #0 always 
+refers to the tree column**.
+
+
+Virtual Events
+^^^^^^^^^^^^^^
+
+The Treeview widget generates the following virtual events. 
+
+   +--------------------+--------------------------------------------------+
+   | event              | description                                      |
+   +====================+==================================================+
+   | <<TreeviewSelect>> | Generated whenever the selection changes.        |
+   +--------------------+--------------------------------------------------+
+   | <<TreeviewOpen>>   | Generated just before settings the focus item to |
+   |                    | open=True.                                       |
+   +--------------------+--------------------------------------------------+
+   | <<TreeviewClose>>  | Generated just after setting the focus item to   |
+   |                    | open=False.                                      |
+   +--------------------+--------------------------------------------------+
+
+The :meth:`Treeview.focus` and :meth:`Treeview.selection` method can be used to
+determine the affected item or items. 
+
 
 Ttk.Treeview
 ^^^^^^^^^^^^


More information about the Python-checkins mailing list