[Python-checkins] r63451 - in sandbox/trunk/ttk-gsoc: Doc/library/ttk.rst src/2.x/ttk.py src/3.x/ttk.py

guilherme.polo python-checkins at python.org
Sun May 18 14:20:42 CEST 2008


Author: guilherme.polo
Date: Sun May 18 14:20:42 2008
New Revision: 63451

Log:
Some doc corrections;
More trailing whitespace removal.


Modified:
   sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst
   sandbox/trunk/ttk-gsoc/src/2.x/ttk.py
   sandbox/trunk/ttk-gsoc/src/3.x/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	Sun May 18 14:20:42 2008
@@ -10,10 +10,10 @@
 
 The :mod:`ttk` module provides access to the Tk themed widget set, which
 has been introduced in Tk 8.5. If you do not have Python compiled against
-Tk 8.5 you may still use this module as long as you have Tile installed and
-you will also miss other features of the new Tk, like anti-aliased font
+Tk 8.5 you may still use this module as long as you have Tile installed, but
+then you will miss some features of the new Tk, like anti-aliased font
 rendering under X11, window transparency (on X11 you will need a composition
-window manager), and others.
+window manager) and others.
 
 The basic idea of :mod:`ttk` is to separate, to the extent possible, the code
 implementing a widget's behavior from the code implementing its appearance.
@@ -41,17 +41,17 @@
    from tkinter import *
    from ttk import *
 
-So several :mod:`ttk` widgets (:class:`Button`, :class:`Entry`, :class:`Frame`,
-:class:`Label`, :class:`LabelFrame`, :class:`Menubutton`, :class:`PanedWindow`,
-:class:`Radiobutton`, :class:`Scrollbar`) will automatically substitute the Tk
-widgets.
+And then several :mod:`ttk` widgets (:class:`Button`, :class:`Entry`,
+:class:`Frame`, :class:`Label`, :class:`LabelFrame`, :class:`Menubutton`,
+:class:`PanedWindow`, :class:`Radiobutton` and :class:`Scrollbar`) will
+automatically substitute the Tk widgets.
 
 This has the direct benefit of using the new widgets which gives better
 look & feel across platforms, but you should be aware that they are not
 totally compatible. The main difference you will find out is that widget
 options such as "fg", "bg" and others related to widget styling are no
-longer present in Ttk widgets, instead you will have to use Ttk :class:`Style`
-to achieve same (or better) styling.
+longer present in Ttk widgets, instead you will have to use :class:`ttk.Style`
+to achieve the same (or better) styling.
 
 
 Ttk Widgets
@@ -62,11 +62,11 @@
 :class:`Label`, :class:`LabelFrame`, :class:`Menubutton`, :class:`PanedWindow`,
 :class:`Radiobutton` and :class:`Scrollbar`. The others 6 are new:
 :class:`Combobox`, :class:`Notebook`, :class:`Progressbar`, :class:`Separator`,
-:class:`Sizegrip` and :class:`Treeview`. And all them are subclasses of
+:class:`Sizegrip` and :class:`Treeview`. And all them are subclass of
 :class:`Widget`.
 
-Like it was told before, you will notice look & feel changes as well changes
-in the styling code. To demonstrate the latter, a simple example follows.
+Like it was told before, you will notice changes in look & feel as well in the
+styling code. To demonstrate the latter, a very simple example is shown below.
 
 Tk code::
 
@@ -89,14 +89,13 @@
 ------
 
 :class:`ttk.Widget` defines standard options and methods supported by Tk
-themed widgets.
+themed widgets and is not supposed to be directly instantiated.
 
 
 Standard Options
 ^^^^^^^^^^^^^^^^
 
-:class:`ttk.Widget` accepts the following options, as well all the other Ttk
-widgets:
+All the :mod:`ttk` Widgets accepts the following options:
 
    +-----------+--------------------------------------------------------------+
    | Option    | Description                                                  |
@@ -119,7 +118,7 @@
    |           | an empty string means that the traversal scripts make the    |
    |           | decision about whether or not to focus on the window.        |
    +-----------+--------------------------------------------------------------+
-   | style     | May be used to specify a custom widget style                 |
+   | style     | May be used to specify a custom widget style.                |
    +-----------+--------------------------------------------------------------+
 
 
@@ -242,7 +241,7 @@
 ttk.Widget
 ^^^^^^^^^^
 
-Besides the methods described below, :class:`ttk.Widget` supports the
+Besides the methods described below, the class :class:`ttk.Widget` supports the
 methods :meth:`tkinter.Widget.cget` and :meth:`tkinter.Widget.configure`.
 
 .. class:: Widget
@@ -276,15 +275,17 @@
 Combobox
 --------
 
-Ttk Combobox widget combines a text field with a pop-down list of values,
-it inherits :class:`Entry`.
+The :class:`ttk.Combobox` widget combines a text field with a pop-down list of
+values. This widget is a subclass of :class:`Entry`.
 
 Besides the methods inherited from :class:`Widget`: :meth:`Widget.cget`,
 :meth:`Widget.configure`, :meth:`Widget.identify`, :meth:`Widget.instate`
 and :meth:`Widget.state`, and the following inherited from :class:`Entry`:
 :meth:`Entry.bbox`, :meth:`Entry.delete`, :meth:`Entry.icursor`,
 :meth:`Entry.index`, :meth:`Entry.inset`, :meth:`Entry.selection`,
-:meth:`Entry.xview`, it has some other methods, described at `ttk.Combobox`_.
+:meth:`Entry.xview`, it has some other methods, described at
+:class:`ttk.Combobox`.
+
 
 Options
 ^^^^^^^
@@ -544,10 +545,10 @@
 Progressbar
 -----------
 
-Ttk Progressbar widget shows the status of a long-running operation. They
-can operate in two modes: determinate mode shows the amount completed
-relative to the total amount of work to be done, and indeterminate mode
-provides an animated display to let the user know that something is
+The :class:`ttk.Progressbar` widget shows the status of a long-running
+operation. It can operate in two modes: determinate mode shows the amount
+completed relative to the total amount of work to be done, and indeterminate
+mode provides an animated display to let the user know that something is
 happening.
 
 
@@ -614,7 +615,8 @@
 Separator
 ---------
 
-Ttk Separator widget displays a horizontal or vertical separator bar.
+The :class:`ttk.Separator` widget displays a horizontal or vertical separator
+bar.
 
 It has no other method besides the ones inherited from :class:`ttk.Widget`.
 
@@ -635,12 +637,12 @@
 Sizegrip
 --------
 
-Ttk Sizegrip widget (also known as grow box) allows the user to resize the
-containing toplevel window by pressing and dragging the grip.
+The :class:`ttk.Sizegrip` widget (also known as grow box) allows the user to
+resize the containing toplevel window by pressing and dragging the grip.
 
 This widget has no specific options neither specific methods, besides the
-ones inherited from `Widget`_.
-   
+ones inherited from :class:`ttk.Widget`.
+
 
 Platform-specific notes
 ^^^^^^^^^^^^^^^^^^^^^^^
@@ -662,9 +664,10 @@
 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 :class:`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
@@ -673,7 +676,7 @@
 
 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
+named {}. 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
@@ -819,8 +822,8 @@
    |                    | open=False.                                      |
    +--------------------+--------------------------------------------------+
 
-The :meth:`Treeview.focus` and :meth:`Treeview.selection` method can be used to
-determine the affected item or items.
+The :meth:`Treeview.focus` and :meth:`Treeview.selection` methods can be used
+to determine the affected item or items.
 
 
 ttk.Treeview
@@ -863,7 +866,7 @@
    .. method:: delete(items)
 
       Delete all specified *items* and all their descendants.
-      
+
       The root item may not be deleted.
 
 
@@ -873,7 +876,7 @@
 
       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.
 
 
@@ -1070,12 +1073,12 @@
 Ttk Styling
 -----------
 
-Each widget is assigned a style, which specifies the set of elements making
-up the widget and how they are arranged, along with dynamic and default
-settings for element options. By default the style name is the same as
-the widget's class prefixed by a "T" (except the root style that is "." and
-Treeview's style is "Treeview"), but it may be overriden by the widget's style
-option.
+Each widget in :mod:`ttk` is assigned a style, which specifies the set of
+elements making up the widget and how they are arranged, along with dynamic
+and default settings for element options. By default the style name is the
+same as the widget's class prefixed by a "T" (except the root style that is "."
+and Treeview's style is "Treeview"), but it may be overriden by the widget's
+style option.
 
 .. seealso::
 
@@ -1115,7 +1118,7 @@
    .. method:: map(style, **kw)
 
       Sets dynamic values of the specified option(s) in *style*.
-      
+
       Each key in *kw* is an option and each value should be a sequence.
       Each of these sequences have to have a state, or a group of states,
       and a value, grouped in yet another sequence. Note that a group of
@@ -1123,7 +1126,7 @@
       passed as state.
 
       An example may make it more understandable::
-      
+
          import tkinter
          import ttk
 
@@ -1143,7 +1146,7 @@
 
 
       There are two things to note in this previous short example:
-        
+
        * The order of the (state, value) sequences for an option does matter,
          if you changed the order to [('active', 'blue'), ('pressed', 'red')]
          for the foreground, for example, you would get a blue foreground when
@@ -1240,13 +1243,13 @@
 
       Temporarily sets the current theme to *themename*, apply specified
       *settings* and then restore the previous theme.
-      
+
       Each key in *settings* is a style and each value may contain the keys
       'configure', 'map', 'layout' and 'element create' and they are expected
       to have the same format as specified by the methods
       :meth:`Style.configure`, :meth:`Style.map`, :meth:`Style.layout` and
       :meth:`Style.element_create` respectively.
-      
+
       As an example, lets change the Combobox for the default theme a bit::
 
          import ttk

Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py	Sun May 18 14:20:42 2008
@@ -492,7 +492,7 @@
 
     def instate(self, statespec, callback=None, *args):
         """Test the widget's state.
-        
+
         If callback is not specified, returns 1 if the widget state
         matches statespec and 0 otherwise. If callback is specified,
         then it will be invoked with *args if the widget state matches
@@ -512,7 +512,7 @@
         is returned indicating which flags were changed. statespec is
         expected to be a sequence."""
         statespec = statespec or ''
-        
+
         return self.tk.splitlist(
             str(self.tk.call(self._w, "state", ' '.join(statespec))))
 
@@ -525,7 +525,7 @@
         """Construct a Ttk Button widget with the parent master.
 
         STANDARD OPTIONS
-            
+
             class, compound, cursor, image, state, style, takefocus,
             text, textvariable, underline, width
 
@@ -543,7 +543,7 @@
         """Construct a Ttk Checkbutton widget with the parent master.
 
         STANDARD OPTIONS
-            
+
             class, compound, cursor, image, state, style, takefocus,
             text, textvariable, underline, width
 
@@ -571,9 +571,9 @@
 
     def __init__(self, master=None, cnf={}, **kw):
         """Constructs a Ttk Entry widget with the parent master.
-        
+
         STANDARD OPTIONS
-            
+
             class, cursor, style, takefocus, xscrollcommand
 
         WIDGET-SPECIFIC OPTIONS
@@ -582,7 +582,7 @@
             textvariable, validate, validatecommand, width
 
         VALIDATION MODES
-            
+
             none, key, focus, focusin, focusout, all
         """
         Widget.__init__(self, master, "ttk::entry", cnf, kw)
@@ -615,7 +615,7 @@
         """Construct a Ttk Combobox widget with the parent master.
 
         STANDARD OPTIONS
-            
+
             class, cursor, style, takefocus
 
         WIDGET-SPECIFIC OPTIONS
@@ -625,7 +625,7 @@
         """
         Widget.__init__(self, master, "ttk::combobox", cnf, kw)
 
-    
+
     def current(self, newindex=None):
         """If newindex is supplied, sets the combobox value to the
         element at position newindex in the list of values. Otherwise,
@@ -647,7 +647,7 @@
         """Construct a Ttk Frame with parent master.
 
         STANDARD OPTIONS
-            
+
             class, cursor, style, takefocus
 
         WIDGET-SPECIFIC OPTIONS

Modified: sandbox/trunk/ttk-gsoc/src/3.x/ttk.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/src/3.x/ttk.py	(original)
+++ sandbox/trunk/ttk-gsoc/src/3.x/ttk.py	Sun May 18 14:20:42 2008
@@ -492,7 +492,7 @@
 
     def instate(self, statespec, callback=None, *args):
         """Test the widget's state.
-        
+
         If callback is not specified, returns 1 if the widget state
         matches statespec and 0 otherwise. If callback is specified,
         then it will be invoked with *args if the widget state matches
@@ -512,7 +512,7 @@
         is returned indicating which flags were changed. statespec is
         expected to be a sequence."""
         statespec = statespec or ''
-        
+
         return self.tk.splitlist(
             str(self.tk.call(self._w, "state", ' '.join(statespec))))
 
@@ -525,7 +525,7 @@
         """Construct a Ttk Button widget with the parent master.
 
         STANDARD OPTIONS
-            
+
             class, compound, cursor, image, state, style, takefocus,
             text, textvariable, underline, width
 
@@ -543,7 +543,7 @@
         """Construct a Ttk Checkbutton widget with the parent master.
 
         STANDARD OPTIONS
-            
+
             class, compound, cursor, image, state, style, takefocus,
             text, textvariable, underline, width
 
@@ -571,9 +571,9 @@
 
     def __init__(self, master=None, cnf={}, **kw):
         """Constructs a Ttk Entry widget with the parent master.
-        
+
         STANDARD OPTIONS
-            
+
             class, cursor, style, takefocus, xscrollcommand
 
         WIDGET-SPECIFIC OPTIONS
@@ -582,7 +582,7 @@
             textvariable, validate, validatecommand, width
 
         VALIDATION MODES
-            
+
             none, key, focus, focusin, focusout, all
         """
         Widget.__init__(self, master, "ttk::entry", cnf, kw)
@@ -615,7 +615,7 @@
         """Construct a Ttk Combobox widget with the parent master.
 
         STANDARD OPTIONS
-            
+
             class, cursor, style, takefocus
 
         WIDGET-SPECIFIC OPTIONS
@@ -625,7 +625,7 @@
         """
         Widget.__init__(self, master, "ttk::combobox", cnf, kw)
 
-    
+
     def current(self, newindex=None):
         """If newindex is supplied, sets the combobox value to the
         element at position newindex in the list of values. Otherwise,
@@ -647,7 +647,7 @@
         """Construct a Ttk Frame with parent master.
 
         STANDARD OPTIONS
-            
+
             class, cursor, style, takefocus
 
         WIDGET-SPECIFIC OPTIONS


More information about the Python-checkins mailing list