[Python-checkins] r63201 - in sandbox/trunk/ttk-gsoc: Doc/library/ttk.rst Lib/lib-tk/Ttk.py Lib/tkinter/ttk.py

guilherme.polo python-checkins at python.org
Tue May 13 14:08:31 CEST 2008


Author: guilherme.polo
Date: Tue May 13 14:08:31 2008
New Revision: 63201

Log:
Fixed a table in the documentation, completed Treeview's methods doc.

Removed section 'Others new features', as it would make sense only if I 
were documenting Tk 8.5, not Ttk.

Revised some docstrings.

version is now 0.0.7


Modified:
   sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst
   sandbox/trunk/ttk-gsoc/Lib/lib-tk/Ttk.py
   sandbox/trunk/ttk-gsoc/Lib/tkinter/ttk.py

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	Tue May 13 14:08:31 2008
@@ -678,7 +678,7 @@
 
    +----------------+--------------------------------------------------------+
    | option         | description                                            |
-   +================+========================================================|
+   +================+========================================================+
    | column         | A list of column identifiers, specifying the number of |
    |                | columns and their names.                               |
    +----------------+--------------------------------------------------------+
@@ -817,60 +817,162 @@
 
    .. method:: bbox(item[, column=None])
 
+      Returns the bounding box (relative to the treeview widget's window) of 
+      the specified *item* in the form (x, y, width, height). 
+      
+      If *column* is specified, returns the bounding box of that cell. If the 
+      *item* is not visible (i.e., if it is a descendant of a closed item or is 
+      scrolled offscren), returns an empty string.
+
 
    .. method:: get_children(item)
 
+      Returns the list of children belonging to *item*.
+
 
    .. method:: set_children(item, newchildren)
 
+      Replaces item's child with *newchildren*.
+
+      Children present in item that are not present in *newchildren* are 
+      detached from tree. No items in *newchildren* may be an ancestor of item.
+
 
    .. method:: column(column, **kw)
 
+      Query or modify the options for the specified *column*. 
+              
+      If no options are specified, returns a dictionary of option/value pairs.
+      If an option is specified with value None, returns the value of that 
+      option. Otherwise, the options are updated with the specified values.
+
 
    .. method:: delete(items)
 
+      Delete all specified *items* and all their descendants. 
+      
+      The root item may not be deleted.
+
 
    .. method:: detach(items)
 
+      Unlinks all of the specified *items* from the tree.
+
+      The items and all of their descendants are still present, and may be 
+      reinserted at another point in the tree, but will not be displayed. 
+      
+      The root item may not be detached.
+
 
    .. method:: exists(item)
 
+      Returns 1 if the specified *item* is present in the three, 0 otherwise.
+
 
    .. method:: focus([item=None])
 
+      If *item* is specified, sets the focus item to *item*. Otherwise, returns
+      the current focus item, or '' if there is none.
+
 
    .. method:: heading(column, **kw)
 
+      Query or modify the heading options for the specified *column*.
+
+      Valid options/values are:
+
+      * text: text
+         The text to display in the column heading.
+      * image: imageName
+         Specifies an image to display to the right of the column heading.
+      * anchor: anchor  
+         Specifies how the heading text should be aligned. One of the standard 
+         Tk anchor values.
+      * command: script
+         A script to evaluate when the heading label is pressed.
+         This could be passed using Misc.register(callback).
+
+       To configure the tree column heading, call this with column = "#0"
+
 
    .. method:: identify(component, x, y)
 
+      Returns a description of the specified *component* under the point given 
+      by *x* and *y*, or the empty string if no such *component* is present at 
+      that position.
+
 
    .. method:: identify_row(y)
 
+      Returns the item ID of the item at position *y*.
+
 
    .. method:: identify_column(x)
 
+      Returns the data column identifier of the cell at position *x*.
+
+      The tree column has ID #0.
+
 
    .. method:: index(item)
 
+      Returns the integer index of *item* within its parent's list of children.
+
 
    .. method:: insert(parent, index[, iid=None[, **kw]])
 
+      Creates a new item and return the item identifier of the newly created 
+      item.
+
+      *parent* is the item ID of the parent item, or the empty string to create
+      a new top-level item. *index* is an integer, or the value "end", 
+      specifying where in the list of parent's children to insert the new item.
+      If *index* is less than or equal to zero, the new node is inserted at 
+      the beginning, if *index* is greater than or equal to the current number 
+      of children, it is inserted at the end. If *iid* is specified, it is used
+      as the item identifier, *iid* must not already exist in the tree. 
+      Otherwise, a new unique identifier is generated.
+
+      See `Item Options`_ for the list of available points.
+
 
    .. method:: item(item, **kw)
 
+      Query or modify the options for the specified *item*. 
+              
+      If no options are specified, returns a dictionary of option/value pairs. 
+      If a single option is specified with value None, returns the value of 
+      that option. Otherwise, the item's options are updated with the specified
+      values.
+
 
    .. method:: move(item, parent, index)
 
+      Moves *item* to position *index* in *parent*'s list of children.
+
+      It is illegal to move an item under one of its descendants. If index is 
+      less than or equal to zero, item is moved to the beginning, if greater 
+      than or equal to the number of children, it is moved to the end. If item 
+      was detached it is reattached.
+
 
    .. method:: next(item)
 
+      Returns the identifier of *item*'s next sibling, or '' if *item* is the 
+      last child of its parent.
+
 
    .. method:: parent(item)
 
+      Returns the ID of the parent of *item*, or '' if *item* is at the top 
+      level of the hierarchy.
+
 
    .. method:: prev(item)
 
+      Returns the identifier of *item*'s previous sibling, or '' if *item* is 
+      the first child of its parent.
+
 
    .. method:: reattach(item, parent, index)
 
@@ -879,36 +981,76 @@
 
    .. method:: see(item)
 
+      Ensure that *item* is visible.
+              
+      Sets all of *item*'s ancestors open option to True, and scrolls the 
+      widget if necessarry so that *item* is within the visible portion of 
+      the tree.
+
 
    .. method:: selection([selop=None[, items=None]])
 
+      If *selop* is not specified, returns selected items. Otherwise, it will
+      act according to the following selection methods.
+
 
    .. method:: selection_set(items)
 
+      *items* becomes the new selection.
+
 
    .. method:: selection_add(items)
 
+      Add *items* to the selection.
+
 
    .. method:: selection_remove(items)
 
+      Remove *items* from the selection.
+
 
    .. method:: selection_toggle(items)
 
+      Toggle the selection state of each item in *items*.
+
 
    .. method:: set(item[, column=None[, value=None]])
 
+      With one argument, returns a dictionary of column/value pairs for the 
+      specified *item*. With two arguments, returns the current value of the 
+      specified *column*. With three arguments, sets the value of given 
+      *column* in *given* item to the specified *value*.
+
 
    .. method:: tag_bind(tagname[, sequence=None[, script=None]])
 
+      Bind a script for the event *sequence* to the tag *tagname*. *script* is 
+      possibly passed using Misc.register(callback) combined with substitutions.
+
+      When an X event is delivered to an item, the script for each of the 
+      item's tags option are called.
+
 
    .. method:: tag_configure(tagname, **kw)
 
+      Query or modify the options for the specified *tagname*.
+
+      If one or more option/value pairs are specified, sets the value of those 
+      options for the specified tag. If a single option is specified with value
+      None, returns the value of that option (or the empty string if the option
+      has not been specified for tagname). With no additional arguments, 
+      returns a dictionary of the option settings for *tagname*.
+
 
    .. method:: xview(*args)
 
+      Query or modify horizontal position of the treeview.
+
 
    .. method:: yview(*args)
 
+      Query or modify vertical position of the treeview.
+
 
 .. _TtkStyling:
 
@@ -1147,8 +1289,3 @@
     the layout name, and the other is a `Layout`_.
 
 .. _Layout: `Layouts`_
-
-Others new features
--------------------
-
-

Modified: sandbox/trunk/ttk-gsoc/Lib/lib-tk/Ttk.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/Lib/lib-tk/Ttk.py	(original)
+++ sandbox/trunk/ttk-gsoc/Lib/lib-tk/Ttk.py	Tue May 13 14:08:31 2008
@@ -12,7 +12,7 @@
 of the widgets appearance lies at Themes.
 """
 
-__version__ = "0.0.5"
+__version__ = "0.0.7"
 
 __author__ = "Guilherme Polo <ggpolo at gmail.com>"
 
@@ -1103,7 +1103,7 @@
                 A script to evaluate when the heading label is pressed.
                 This could be passed using Misc.register(callback).
 
-        Pass column as #0 to configure the tree column heading."""
+        To configure the tree column heading, call this with column = "#0" """
         return self.tk.call(self._w, "heading", column, *(_format_optdict(kw)))
     
 
@@ -1133,7 +1133,8 @@
 
 
     def insert(self, parent, index, iid=None, **kw):
-        """Creates a new item.
+        """Creates a new item and return the item identifier of the newly
+        created item.
 
         parent is the item ID of the parent item, or the empty string 
         to create a new top-level item. index is an integer, or the value
@@ -1143,9 +1144,7 @@
         the current number of children, it is inserted at the end. If iid
         is specified, it is used as the item identifier, iid must not 
         already exist in the tree. Otherwise, a new unique identifier
-        is generated.
-        
-        Returns the item identifier of the newly created item."""
+        is generated."""
         if iid:
             res = self.tk.call(self._w, "insert", parent, index, "-id", iid, 
                                *(_format_optdict(kw)))

Modified: sandbox/trunk/ttk-gsoc/Lib/tkinter/ttk.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/Lib/tkinter/ttk.py	(original)
+++ sandbox/trunk/ttk-gsoc/Lib/tkinter/ttk.py	Tue May 13 14:08:31 2008
@@ -12,7 +12,7 @@
 of the widgets appearance lies at Themes.
 """
 
-__version__ = "0.0.5"
+__version__ = "0.0.7"
 
 __author__ = "Guilherme Polo <ggpolo at gmail.com>"
 
@@ -1103,7 +1103,7 @@
                 A script to evaluate when the heading label is pressed.
                 This could be passed using Misc.register(callback).
 
-        Pass column as #0 to configure the tree column heading."""
+        To configure the tree column heading, call this with column = "#0" """
         return self.tk.call(self._w, "heading", column, *(_format_optdict(kw)))
     
 
@@ -1133,7 +1133,8 @@
 
 
     def insert(self, parent, index, iid=None, **kw):
-        """Creates a new item.
+        """Creates a new item and return the item identifier of the newly
+        created item.
 
         parent is the item ID of the parent item, or the empty string 
         to create a new top-level item. index is an integer, or the value
@@ -1143,9 +1144,7 @@
         the current number of children, it is inserted at the end. If iid
         is specified, it is used as the item identifier, iid must not 
         already exist in the tree. Otherwise, a new unique identifier
-        is generated.
-        
-        Returns the item identifier of the newly created item."""
+        is generated."""
         if iid:
             res = self.tk.call(self._w, "insert", parent, index, "-id", iid, 
                                *(_format_optdict(kw)))


More information about the Python-checkins mailing list