[Python-checkins] r63433 - in sandbox/trunk/ttk-gsoc: Doc/library/ttk.rst samples/combo_themes.py samples/dirbrowser.py samples/mac_searchentry.py samples/notebook_closebtn.py samples/roundframe.py samples/theme_selector.py samples/treeview_multicolumn.py src/2.x/ttk.py src/3.x/ttk.py

guilherme.polo python-checkins at python.org
Sat May 17 23:18:14 CEST 2008


Author: guilherme.polo
Date: Sat May 17 23:18:13 2008
New Revision: 63433

Log:
Changed the layout format expected by the layout method, now it is   
expected to be a list. This was done to accommodate the possibility
of creating a layout twice with different options, which is accepted.

ttk py3k version uses package tkinter now.

Removed trailing whitespace.


Modified:
   sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst
   sandbox/trunk/ttk-gsoc/samples/combo_themes.py
   sandbox/trunk/ttk-gsoc/samples/dirbrowser.py
   sandbox/trunk/ttk-gsoc/samples/mac_searchentry.py
   sandbox/trunk/ttk-gsoc/samples/notebook_closebtn.py
   sandbox/trunk/ttk-gsoc/samples/roundframe.py
   sandbox/trunk/ttk-gsoc/samples/theme_selector.py
   sandbox/trunk/ttk-gsoc/samples/treeview_multicolumn.py
   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	Sat May 17 23:18:13 2008
@@ -15,8 +15,8 @@
 rendering under X11, window transparency (on X11 you will need a composition
 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. 
+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.
 
 
 .. seealso::
@@ -43,14 +43,14 @@
 
 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. 
+:class:`Radiobutton`, :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` 
+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.
 
 
@@ -58,11 +58,11 @@
 -----------
 
 Ttk comes with 16 widgets, where 10 of these already existed in Tkinter:
-:class:`Button`, :class:`Checkbutton`, :class:`Entry`, :class:`Frame`, 
-:class:`Label`, :class:`LabelFrame`, :class:`Menubutton`, :class:`PanedWindow`, 
+:class:`Button`, :class:`Checkbutton`, :class:`Entry`, :class:`Frame`,
+: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 subclasses of
 :class:`Widget`.
 
 Like it was told before, you will notice look & feel changes as well changes
@@ -82,7 +82,7 @@
    l1 = ttk.Label(text="Test", style="BW.TLabel")
    l2 = ttk.Label(text="Test", style="BW.TLabel")
 
-For more information about TtkStyling_ read the :class:`Style` class 
+For more information about TtkStyling_ read the :class:`Style` class
 documentation.
 
 Widget
@@ -241,7 +241,7 @@
 
 ttk.Widget
 ^^^^^^^^^^
-   
+
 Besides the methods described below, :class:`ttk.Widget` supports the
 methods :meth:`tkinter.Widget.cget` and :meth:`tkinter.Widget.configure`.
 
@@ -249,7 +249,7 @@
 
    .. method:: identify(x, y)
 
-      Returns the name of the element at position *x* *y*, or the empty string 
+      Returns the name of the element at position *x* *y*, or the empty string
       if the point does not lie within any element.
 
       *x* and *y* are pixel coordinates relative to the widget.
@@ -259,7 +259,7 @@
 
       Test the widget's state. If a callback is not specified, returns 1
       if the widget state matches *statespec* and 0 otherwise. If callback
-      is specified then it is called with args if widget state matches 
+      is specified then it is called with args if widget state matches
       *statespec*.
 
 
@@ -277,12 +277,12 @@
 --------
 
 Ttk Combobox widget combines a text field with a pop-down list of values,
-it inherits :class:`Entry`. 
+it inherits :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`, 
+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`_.
 
@@ -339,7 +339,7 @@
 ^^^^^^^^^^^^
 
 .. class:: Combobox
- 
+
    .. method:: current([newindex=None])
 
       If newindex is specified, sets the combobox value to the element position
@@ -361,7 +361,7 @@
 --------
 
 Ttk Notebook widget manages a collection of windows and displays a single
-one at a time. Each child window is associated with a tab, which the user 
+one at a time. Each child window is associated with a tab, which the user
 may select to change the currently-displayed window.
 
 
@@ -474,19 +474,19 @@
       Hides the tab specified by *tab_id*.
 
       The tab will not be displayed, but the associated window remains
-      managed by the notebook and its configuration remembered. Hidden tabs 
+      managed by the notebook and its configuration remembered. Hidden tabs
       may be restored with the add command.
 
 
    .. method:: identify(x, y)
 
-      Returns the name of the tab element at position *x*, *y*, or the empty 
+      Returns the name of the tab element at position *x*, *y*, or the empty
       string if none.
 
 
    .. method:: index(tab_id)
 
-      Returns the numeric index of the tab specified by *tab_id*, or the total 
+      Returns the numeric index of the tab specified by *tab_id*, or the total
       number of tabs if *tab_id* is the string "end".
 
 
@@ -494,8 +494,8 @@
 
       Inserts a pane at the specified position.
 
-      *pos* is either the string end, an integer index, or the name of a 
-      managed child. If *child* is already managed by the notebook, moves it to 
+      *pos* is either the string end, an integer index, or the name of a
+      managed child. If *child* is already managed by the notebook, moves it to
       the specified position.
 
       See `Tab Options`_ for the list of available options.
@@ -505,8 +505,8 @@
 
       Selects the specified *tab_id*.
 
-      The associated child window will be displayed, and the 
-      previously-selected window (if different) is unmapped. If *tab_id* is 
+      The associated child window will be displayed, and the
+      previously-selected window (if different) is unmapped. If *tab_id* is
       omitted, returns the widget name of the currently selected pane.
 
 
@@ -515,7 +515,7 @@
       Query or modify the options of the specific *tab_id*.
 
       If no option is specified, returns a dictionary of the tab option values.
-      If one option is specified, returns the value of that option. Otherwise, 
+      If one option is specified, returns the value of that option. Otherwise,
       sets the options to the corresponding values.
 
 
@@ -528,7 +528,7 @@
 
       Enable keyboard traversal for a toplevel window containing this notebook.
 
-      This will extend the bindings for the toplevel window containing the 
+      This will extend the bindings for the toplevel window containing the
       notebook as follows:
 
       * Control-Tab: selects the tab following the currently selected one
@@ -544,10 +544,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 
+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
 happening.
 
 
@@ -600,8 +600,8 @@
 
    .. method:: step([amount])
 
-      Increments progressbar's value by *amount*. 
-      
+      Increments progressbar's value by *amount*.
+
       *amount* defaults to 1.0 if omitted.
 
 
@@ -623,7 +623,7 @@
 ^^^^^^^
 
 This widget accepts the following specific option:
-   
+
    +--------+----------------------------------------------------------------+
    | option | description                                                    |
    +========+================================================================+
@@ -645,14 +645,14 @@
 Platform-specific notes
 ^^^^^^^^^^^^^^^^^^^^^^^
 
-* On Mac OSX, toplevel windows automatically include a built-in size grip 
-  by default. Adding a Sizegrip there is harmless, since the built-in 
+* On Mac OSX, toplevel windows automatically include a built-in size grip
+  by default. Adding a Sizegrip there is harmless, since the built-in
   grip will just mask the widget.
 
 
 Bugs
 ^^^^
-      
+
 * If the containing toplevel's position was specified relative to the right
   or bottom of the screen (e.g. ....), the Sizegrip widget will not resize
   the window.
@@ -662,8 +662,8 @@
 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 
+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
@@ -735,8 +735,8 @@
 Item Options
 ^^^^^^^^^^^^
 
-The following item options may be specified for items in the insert and item 
-widget commands. 
+The following item options may be specified for items in the insert and item
+widget commands.
 
    +--------+---------------------------------------------------------------+
    | option | description                                                   |
@@ -762,7 +762,7 @@
 Tag Options
 ^^^^^^^^^^^
 
-The following options may be specified on tags: 
+The following options may be specified on tags:
 
    +------------+-----------------------------------------------------------+
    | option     | description                                               |
@@ -781,7 +781,7 @@
 Column Identifiers
 ^^^^^^^^^^^^^^^^^^
 
-Column identifiers take any of the following forms: 
+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.
@@ -798,14 +798,14 @@
 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 
+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. 
+The Treeview widget generates the following virtual events.
 
    +--------------------+--------------------------------------------------+
    | event              | description                                      |
@@ -820,7 +820,7 @@
    +--------------------+--------------------------------------------------+
 
 The :meth:`Treeview.focus` and :meth:`Treeview.selection` method can be used to
-determine the affected item or items. 
+determine the affected item or items.
 
 
 ttk.Treeview
@@ -830,11 +830,11 @@
 
    .. 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 
+      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 offscreen), returns an empty string.
 
 
@@ -847,22 +847,22 @@
 
       Replaces item's child with *newchildren*.
 
-      Children present in item that are not present in *newchildren* are 
+      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*. 
-              
+      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 
+      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. 
+      Delete all specified *items* and all their descendants.
       
       The root item may not be deleted.
 
@@ -871,8 +871,8 @@
 
       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 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.
 
@@ -898,8 +898,8 @@
          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 
+      * 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.
@@ -910,8 +910,8 @@
 
    .. 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 
+      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.
 
 
@@ -934,16 +934,16 @@
 
    .. method:: insert(parent, index[, iid=None[, **kw]])
 
-      Creates a new item and return the item identifier of the newly created 
+      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", 
+      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 
+      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. 
+      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.
@@ -951,10 +951,10 @@
 
    .. 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 
+      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.
 
@@ -963,27 +963,27 @@
 
       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 
+      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 
+      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 
+      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 
+      Returns the identifier of *item*'s previous sibling, or '' if *item* is
       the first child of its parent.
 
 
@@ -995,9 +995,9 @@
    .. method:: see(item)
 
       Ensure that *item* is visible.
-              
-      Sets all of *item*'s ancestors open option to True, and scrolls the 
-      widget if necessary so that *item* is within the visible portion of 
+
+      Sets all of *item*'s ancestors open option to True, and scrolls the
+      widget if necessary so that *item* is within the visible portion of
       the tree.
 
 
@@ -1029,18 +1029,18 @@
 
    .. 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 
+      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 
+      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 
+      When an X event is delivered to an item, the script for each of the
       item's tags option are called.
 
 
@@ -1048,10 +1048,10 @@
 
       Query or modify the options for the specified *tagname*.
 
-      If one or more option/value pairs are specified, sets the value of those 
+      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, 
+      has not been specified for tagname). With no additional arguments,
       returns a dictionary of the option settings for *tagname*.
 
 
@@ -1074,7 +1074,7 @@
 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 
+Treeview's style is "Treeview"), but it may be overriden by the widget's style
 option.
 
 .. seealso::
@@ -1103,7 +1103,7 @@
 
          root = tkinter.Tk()
 
-         ttk.Style().configure("TButton", padding=6, relief="flat", 
+         ttk.Style().configure("TButton", padding=6, relief="flat",
             background="#ccc")
 
          btn = ttk.Button(text="Sample")
@@ -1114,11 +1114,11 @@
 
    .. method:: map(style, **kw)
 
-      Sets dynamic values of the specified option(s) in *style*. 
+      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 
+      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
       states is expected to be a sequence, otherwise a single string should be
       passed as state.
 
@@ -1130,10 +1130,10 @@
          root = tkinter.Tk()
 
          style = ttk.Style()
-         style.map("C.TButton", 
-             foreground=[('pressed', 'red'), 
+         style.map("C.TButton",
+             foreground=[('pressed', 'red'),
                          ('active', 'blue')],
-             background=[(('pressed', '!disabled'), 'black'), 
+             background=[(('pressed', '!disabled'), 'black'),
                          ('active', 'white')]
              )
 
@@ -1144,13 +1144,13 @@
 
       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 
-         the widget were in active or pressed states. 
-       * In the background option, (('pressed', '!disabled'), 'black') was 
+       * 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
+         the widget were in active or pressed states.
+       * In the background option, (('pressed', '!disabled'), 'black') was
          specified for grouping the states 'pressed' and '!disabled', but it
-         has no different effect than using just 'pressed' for this example, 
+         has no different effect than using just 'pressed' for this example,
          this was done just to explain the documentation.
 
 
@@ -1174,38 +1174,40 @@
       Define the widget layout for given *style*. If *layoutspec* is omitted,
       return the layout specification for given style.
 
-      *layoutspec*, if specified, is expected to be a dict, where each key is
-      a layout name and the value format is described in `Layouts`_.
+      *layoutspec*, if specified, is expected to be a list, or some other
+      sequence type, where each item should be a tuple and the first item is
+      the layout name and the second item should have the format described
+      described in `Layouts`_.
 
 
    .. method:: element_create(elementname, etype, *args, **kw)
 
       Create a new element in the current theme of given *etype* which is
-      expected to be either "image" or "from". 
+      expected to be either "image" or "from".
 
-      If "image" is used, *args* should contain the default image name followed 
-      by statespec/value pairs (this is the imagespec), *kw* may have the 
+      If "image" is used, *args* should contain the default image name followed
+      by statespec/value pairs (this is the imagespec), *kw* may have the
       following options:
 
        * border=padding
-          padding is a list of up to four integers, specifying the left, top, 
+          padding is a list of up to four integers, specifying the left, top,
           right, and bottom borders, respectively.
 
        * height=height
-          Specifies a minimum height for the element. If less than zero, the 
+          Specifies a minimum height for the element. If less than zero, the
           base image's height is used as a default.
 
        * padding=padding
-          Specifies the element's interior padding. Defaults to border's value 
+          Specifies the element's interior padding. Defaults to border's value
           if not specified.
 
        * sticky=spec
-          Specifies how the image is placed within the final parcel. spec 
+          Specifies how the image is placed within the final parcel. spec
           contains zero or more characters “n”, “s”, “w”, or “e”.
 
        * width=width
-          Specifies a minimum width for the element. If less than zero, the 
-          base image's width is used as a default. 
+          Specifies a minimum width for the element. If less than zero, the
+          base image's width is used as a default.
 
       But if "from" is used, then :meth:`element_create` will clone an existing
       element. *args* is expected to contain a themename, which is from where
@@ -1213,7 +1215,7 @@
       If this element to clone from is not specified, an empty element will
       be used. *kw* is discarded here.
 
-   
+
    .. method:: element_names()
 
       Returns the list of elements defined in the current theme.
@@ -1225,23 +1227,23 @@
 
 
    .. method:: theme_create(themename[, parent=None[, settings=None]])
-      
+
       Create a new theme.
 
-      It is an error if *themename* already exists. If *parent* is specified, 
-      the new theme will inherit styles, elements and layouts from the parent 
-      theme. If *settings* are present they are expected to have the same 
+      It is an error if *themename* already exists. If *parent* is specified,
+      the new theme will inherit styles, elements and layouts from the parent
+      theme. If *settings* are present they are expected to have the same
       syntax used for :meth:`theme_settings`.
 
 
    .. method:: theme_settings(themename, settings)
 
-      Temporarily sets the current theme to *themename*, apply specified 
+      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 
+      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.
       
@@ -1257,10 +1259,10 @@
             "TCombobox": {
                 "configure": {"padding": 5},
                 "map": {
-                    "background": [("active", "green2"), 
+                    "background": [("active", "green2"),
                                    ("!disabled", "green4")],
                     "fieldbackground": [("!disabled", "green3")],
-                    "foreground": [("focus", "OliveDrab1"), 
+                    "foreground": [("focus", "OliveDrab1"),
                                    ("!disabled", "OliveDrab2")]
                 }
             }
@@ -1274,7 +1276,7 @@
    .. method:: theme_names()
 
       Returns a list of all known themes.
-       
+
 
    .. method:: theme_use(themename)
 
@@ -1284,14 +1286,14 @@
 Layouts
 ^^^^^^^
 
-A layout can be just None, if takes no options, or another dict of options 
-specifying how to arrange the element. The layout mechanism uses a simplified 
-version of the pack geometry manager: given an initial cavity, each element is 
+A layout can be just None, if takes no options, or a dict of options specifying
+how to arrange the element. The layout mechanism uses a simplified
+version of the pack geometry manager: given an initial cavity, each element is
 allocated a parcel. Valid options/values are:
 
  * side: whichside
     Specifies which side of the cavity to place the the element; one of
-    top, right, bottom or left. If omitted, the element occupies the 
+    top, right, bottom or left. If omitted, the element occupies the
     entire cavity.
 
  * sticky: nswe
@@ -1304,7 +1306,7 @@
  * unit: XXX
 
  * children: [sublayout... ]
-    Specifies a list of elements to place inside the element. Each 
+    Specifies a list of elements to place inside the element. Each
     element is a tuple (or other sequence type) where the first item is
     the layout name, and the other is a `Layout`_.
 

Modified: sandbox/trunk/ttk-gsoc/samples/combo_themes.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/samples/combo_themes.py	(original)
+++ sandbox/trunk/ttk-gsoc/samples/combo_themes.py	Sat May 17 23:18:13 2008
@@ -16,7 +16,7 @@
         if event.widget.current(): # value #0 is not a theme
             newtheme = event.widget.get()
             # change to the new theme and refresh all the widgets
-            self.style.theme_use(newtheme)                         
+            self.style.theme_use(newtheme)
 
     def _setup_widgets(self):
         # XXX Not how we have to convert from tuple to list (to add a new
@@ -25,23 +25,23 @@
         #     can be done towards this.
         themes = list(self.style.theme_names())
         themes.insert(0, "Pick a theme")
-        # Create a readonly Combobox which will display 4 values at max, 
+        # Create a readonly Combobox which will display 4 values at max,
         # which will cause it to create a scrollbar if there are more
         # than 4 values in total.
-        themes_combo = ttk.Combobox(self, values=tuple(themes), 
+        themes_combo = ttk.Combobox(self, values=tuple(themes),
             state="readonly", height=4)
         themes_combo.set(themes[0]) # sets the combobox value to "Pick a theme"
-        # Combobox widget generates a <<ComboboxSelected>> virtual event 
-        # when the user selects an element. This event is generated after 
+        # Combobox widget generates a <<ComboboxSelected>> virtual event
+        # when the user selects an element. This event is generated after
         # the listbox is unposted (after you select an item, the combobox's
         # listbox disappears, then it is said that listbox is now unposted).
         themes_combo.bind("<<ComboboxSelected>>", self._change_theme)
         themes_combo.pack(fill='x')
 
         self.pack(fill='both', expand=1)
-        
 
-def main(): 
+
+def main():
     app = App()
     app.master.title("Ttk Combobox")
     app.mainloop()

Modified: sandbox/trunk/ttk-gsoc/samples/dirbrowser.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/samples/dirbrowser.py	(original)
+++ sandbox/trunk/ttk-gsoc/samples/dirbrowser.py	Sat May 17 23:18:13 2008
@@ -18,11 +18,11 @@
 
     parent = tree.parent(node)
     special_dirs = [] if parent else glob.glob('.') + glob.glob('..')
-   
+
     for p in special_dirs + os.listdir(path):
         ptype = None
         p = os.path.join(path, p).replace('\\', '/')
-        if os.path.isdir(p): ptype = "directory" 
+        if os.path.isdir(p): ptype = "directory"
         elif os.path.isfile(p): ptype = "file"
 
         fname = os.path.split(p)[1]
@@ -72,7 +72,7 @@
 vsb = ttk.Scrollbar(orient="vertical")
 hsb = ttk.Scrollbar(orient="horizontal")
 
-tree = ttk.Treeview(columns=("fullpath", "type", "size"), 
+tree = ttk.Treeview(columns=("fullpath", "type", "size"),
     displaycolumns="size", yscrollcommand=lambda f, l: autoscroll(vsb, f, l),
     xscrollcommand=lambda f, l:autoscroll(hsb, f, l))
 

Modified: sandbox/trunk/ttk-gsoc/samples/mac_searchentry.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/samples/mac_searchentry.py	(original)
+++ sandbox/trunk/ttk-gsoc/samples/mac_searchentry.py	Sat May 17 23:18:13 2008
@@ -8,45 +8,45 @@
 root = Tkinter.Tk()
 
 data = """
- R0lGODlhKgAaAOfnAFdZVllbWFpcWVtdWlxeW11fXF9hXmBiX2ZnZWhpZ2lraGxua25wbXJ0
- cXR2c3V3dHZ4dXh6d3x+e31/fH6AfYSGg4eJhoiKh4qMiYuNio2PjHmUqnqVq3yXrZGTkJKU
- kX+asJSWk32cuJWXlIGcs5aYlX6euZeZloOetZial4SftpqbmIWgt4GhvYahuIKivpudmYei
- uYOjv5yem4ijuoSkwIWlwYmlu56gnYamwp+hnoenw4unvaCin4ioxJCnuZykrImpxZmlsoaq
- zI2pv6KkoZGouoqqxpqms4erzaOloo6qwYurx5Kqu5untIiszqSmo5CrwoysyJeqtpOrvJyo
- tZGsw42typSsvaaopZKtxJWtvp6qt4+uy6epppOuxZCvzKiqp5quuZSvxoyx06mrqJWwx42y
- 1JKxzpmwwaqsqZaxyI6z1ZqxwqutqpOzz4+01qyuq56yvpizypS00Jm0y5W10Zq1zJa20rCy
- rpu3zqizwbGzr6C3yZy4z7K0saG4yp250LO1sqK5y5660Z+70qO7zKy4xaC806S8zba4taG9
- 1KW9zq66x6+7yLi6t6S/1rC8yrm7uLO8xLG9y7q8ubS9xabB2anB07K+zLW+xrO/za7CzrTA
- zrjAyLXBz77BvbbC0K/G2LjD0bnE0rLK28TGw8bIxcLL07vP28HN28rMycvOyr/T38DU4cnR
- 2s/RztHT0NLU0cTY5MrW5MvX5dHX2c3Z59bY1dPb5Nbb3dLe7Nvd2t3f3NXh797g3d3j5dnl
- 9OPl4eTm4+Ln6tzo9uXn5Obo5eDp8efp5uHq8uXq7ejq5+nr6OPs9Ovu6unu8O3v6+vw8+7w
- 7ezx9O/x7vDy7/Hz8O/19/P18vT38/L3+fb49Pf59vX6/fj69/b7/vn7+Pr8+ff9//v9+vz/
- +/7//P//////////////////////////////////////////////////////////////////
- /////////////////////////////////yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJZAD/ACwC
- AAIAKAAWAAAI/gD/CRz4bwUGCg8eQFjIsGHDBw4iTLAQgqBFgisuePCiyJOpUyBDihRpypMi
- Lx8qaLhIMIyGFZ5sAUsmjZrNmzhzWpO2DJgtTysqfGDpxoMbW8ekeQsXzty4p1CjRjUXrps3
- asJsuclQ4uKKSbamMR3n1JzZs2jRkh1HzuxVXX8y4CDYAwqua+DInVrRwMGJU2kDp31KThy1
- XGWGDlxhi1rTPAUICBBAoEAesoIzn6Vm68MKgVAUHftmzhOCBCtQwQKSoABgzZnJdSMmyIPA
- FbCotdUQAIhNa9B6DPCAGbZac+SowVIMRVe4pwkA4GpqDlwuAAmMZx4nTtfnf1mO5JEDNy46
- MHJkxQEDgKC49rPjwC0bqGaZuOoZAKjBPE4NgAzUvYcWOc0QZF91imAnCDHJ5JFAAJN0I2Ba
- 4iRDUC/gOEVNDwIUcEABCAgAAATUTIgWOMBYRFp80ghiAQIIVAAEAwJIYI2JZnUji0XSYAYO
- NcsQA8wy0hCTwAASXGOiONFcxAtpTokTHznfiLMNMAkcAMuE43jDC0vLeGOWe2R5o4sn1LgH
- GzkWsvTPMgEOaA433Ag4TjjMuDkQMNi0tZ12sqWoJ0HATMPNffAZZ6U0wLAyqJ62RGoLLrhI
- aqmlpzwaEAAh+QQJZAD/ACwAAAAAKgAaAAAI/gD/CRw40JEhQoEC+fGjcOHCMRAjRkxDsKLF
- f5YcAcID582ZjyBDJhmZZIjJIUySEDHiBMhFghrtdNnRAgSHmzhz6sTZQcSLITx+CHn5bxSk
- Nz5MCMGy55CjTVCjbuJEtSrVQ3uwqDBRQwrFi476SHHxow8qXcemVbPGtm21t3CnTaP27Jgu
- VHtuiIjBsuImQkRiiEEFTNo2cOTMKV7MuLE5cN68QUOGSgwKG1EqJqJDY8+rZt8UjxtNunTj
- cY3DgZOWS46KIFgGjiI0ZIsqaqNNjWjgYMUpx8Adc3v2aosNMAI1DbqyI9WycOb4IAggQEAB
- A3lQBxet/TG4cMpI/tHwYeSfIzxM0uTKNs7UgAQrYL1akaDA7+3bueVqY4NJlUhIcQLNYx8E
- AIQ01mwjTQ8DeNAdfouNA8440GBCQxJY3MEGD6p4Y844CQCAizcSgpMLAAlAuJ03qOyQRBR3
- nEHEK+BMGKIui4kDDAAIPKiiYuSYSMQQRCDCxhiziPMYBgDkEaEaAGQA3Y+MjUPOLFoMoUUh
- cKxRC4ngeILiH8Qkk0cCAUzSDZWpzbLEE1EwggcYqWCj2DNADFDAAQUgIAAAEFDDJmPYqNJF
- F1s4cscTmCDjDTjdSPOHBQggUAEQDAgggTWDPoYMJkFoUdRmddyyjWLeULMMMcAsIw0x4wkM
- IME1g25zyxpHxFYUHmyIggw4H4ojITnfiLMNMAkcAAub4BQjihRdDGTJHmvc4Qo1wD6Imje6
- eILbj+BQ4wqu5Q3ECSJ0FOKKMtv4mBg33Pw4zjbKuBIIE1xYpIkhdQQiyi7OtAucj6dt48wu
- otQhBRa6VvSJIRwhIkotvgRTzMUYZ6xxMcj4QkspeKDxxRhEmUfIHWjAgQcijEDissuXvCyz
- zH7Q8YQURxDhUsn/bCInR3AELfTQZBRt9BBJkCGFFVhMwTNBlnBCSCGEIJQQIAklZMXWRBAR
- RRRWENHwRQEBADs="""
+R0lGODlhKgAaAOfnAFdZVllbWFpcWVtdWlxeW11fXF9hXmBiX2ZnZWhpZ2lraGxua25wbXJ0
+cXR2c3V3dHZ4dXh6d3x+e31/fH6AfYSGg4eJhoiKh4qMiYuNio2PjHmUqnqVq3yXrZGTkJKU
+kX+asJSWk32cuJWXlIGcs5aYlX6euZeZloOetZial4SftpqbmIWgt4GhvYahuIKivpudmYei
+uYOjv5yem4ijuoSkwIWlwYmlu56gnYamwp+hnoenw4unvaCin4ioxJCnuZykrImpxZmlsoaq
+zI2pv6KkoZGouoqqxpqms4erzaOloo6qwYurx5Kqu5untIiszqSmo5CrwoysyJeqtpOrvJyo
+tZGsw42typSsvaaopZKtxJWtvp6qt4+uy6epppOuxZCvzKiqp5quuZSvxoyx06mrqJWwx42y
+1JKxzpmwwaqsqZaxyI6z1ZqxwqutqpOzz4+01qyuq56yvpizypS00Jm0y5W10Zq1zJa20rCy
+rpu3zqizwbGzr6C3yZy4z7K0saG4yp250LO1sqK5y5660Z+70qO7zKy4xaC806S8zba4taG9
+1KW9zq66x6+7yLi6t6S/1rC8yrm7uLO8xLG9y7q8ubS9xabB2anB07K+zLW+xrO/za7CzrTA
+zrjAyLXBz77BvbbC0K/G2LjD0bnE0rLK28TGw8bIxcLL07vP28HN28rMycvOyr/T38DU4cnR
+2s/RztHT0NLU0cTY5MrW5MvX5dHX2c3Z59bY1dPb5Nbb3dLe7Nvd2t3f3NXh797g3d3j5dnl
+9OPl4eTm4+Ln6tzo9uXn5Obo5eDp8efp5uHq8uXq7ejq5+nr6OPs9Ovu6unu8O3v6+vw8+7w
+7ezx9O/x7vDy7/Hz8O/19/P18vT38/L3+fb49Pf59vX6/fj69/b7/vn7+Pr8+ff9//v9+vz/
++/7//P//////////////////////////////////////////////////////////////////
+/////////////////////////////////yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJZAD/ACwC
+AAIAKAAWAAAI/gD/CRz4bwUGCg8eQFjIsGHDBw4iTLAQgqBFgisuePCiyJOpUyBDihRpypMi
+Lx8qaLhIMIyGFZ5sAUsmjZrNmzhzWpO2DJgtTysqfGDpxoMbW8ekeQsXzty4p1CjRjUXrps3
+asJsuclQ4uKKSbamMR3n1JzZs2jRkh1HzuxVXX8y4CDYAwqua+DInVrRwMGJU2kDp31KThy1
+XGWGDlxhi1rTPAUICBBAoEAesoIzn6Vm68MKgVAUHftmzhOCBCtQwQKSoABgzZnJdSMmyIPA
+FbCotdUQAIhNa9B6DPCAGbZac+SowVIMRVe4pwkA4GpqDlwuAAmMZx4nTtfnf1mO5JEDNy46
+MHJkxQEDgKC49rPjwC0bqGaZuOoZAKjBPE4NgAzUvYcWOc0QZF91imAnCDHJ5JFAAJN0I2Ba
+4iRDUC/gOEVNDwIUcEABCAgAAATUTIgWOMBYRFp80ghiAQIIVAAEAwJIYI2JZnUji0XSYAYO
+NcsQA8wy0hCTwAASXGOiONFcxAtpTokTHznfiLMNMAkcAMuE43jDC0vLeGOWe2R5o4sn1LgH
+GzkWsvTPMgEOaA433Ag4TjjMuDkQMNi0tZ12sqWoJ0HATMPNffAZZ6U0wLAyqJ62RGoLLrhI
+aqmlpzwaEAAh+QQJZAD/ACwAAAAAKgAaAAAI/gD/CRw40JEhQoEC+fGjcOHCMRAjRkxDsKLF
+f5YcAcID582ZjyBDJhmZZIjJIUySEDHiBMhFghrtdNnRAgSHmzhz6sTZQcSLITx+CHn5bxSk
+Nz5MCMGy55CjTVCjbuJEtSrVQ3uwqDBRQwrFi476SHHxow8qXcemVbPGtm21t3CnTaP27Jgu
+VHtuiIjBsuImQkRiiEEFTNo2cOTMKV7MuLE5cN68QUOGSgwKG1EqJqJDY8+rZt8UjxtNunTj
+cY3DgZOWS46KIFgGjiI0ZIsqaqNNjWjgYMUpx8Adc3v2aosNMAI1DbqyI9WycOb4IAggQEAB
+A3lQBxet/TG4cMpI/tHwYeSfIzxM0uTKNs7UgAQrYL1akaDA7+3bueVqY4NJlUhIcQLNYx8E
+AIQ01mwjTQ8DeNAdfouNA8440GBCQxJY3MEGD6p4Y844CQCAizcSgpMLAAlAuJ03qOyQRBR3
+nEHEK+BMGKIui4kDDAAIPKiiYuSYSMQQRCDCxhiziPMYBgDkEaEaAGQA3Y+MjUPOLFoMoUUh
+cKxRC4ngeILiH8Qkk0cCAUzSDZWpzbLEE1EwggcYqWCj2DNADFDAAQUgIAAAEFDDJmPYqNJF
+F1s4cscTmCDjDTjdSPOHBQggUAEQDAgggTWDPoYMJkFoUdRmddyyjWLeULMMMcAsIw0x4wkM
+IME1g25zyxpHxFYUHmyIggw4H4ojITnfiLMNMAkcAAub4BQjihRdDGTJHmvc4Qo1wD6Imje6
+eILbj+BQ4wqu5Q3ECSJ0FOKKMtv4mBg33Pw4zjbKuBIIE1xYpIkhdQQiyi7OtAucj6dt48wu
+otQhBRa6VvSJIRwhIkotvgRTzMUYZ6xxMcj4QkspeKDxxRhEmUfIHWjAgQcijEDissuXvCyz
+zH7Q8YQURxDhUsn/bCInR3AELfTQZBRt9BBJkCGFFVhMwTNBlnBCSCGEIJQQIAklZMXWRBAR
+RRRWENHwRQEBADs="""
 
 
 s1 = Tkinter.PhotoImage("search1", data=data, format="gif -index 0")
@@ -57,13 +57,13 @@
 style.element_create("Search.field", "image", "search1", ("focus", "search2"),
     border=[22, 7, 14], sticky="ew")
 
-style.layout("Search.entry", {
-    "Search.field": {"sticky": "nswe", "border": 1, "children":
+style.layout("Search.entry", [
+    ("Search.field", {"sticky": "nswe", "border": 1, "children":
         [("Entry.padding", {"sticky": "nswe", "children":
             [("Entry.textarea", {"sticky": "nswe"})]
         })]
-    }
-})
+    })]
+)
 
 style.configure("Search.entry", background="#b2b2b2")
 

Modified: sandbox/trunk/ttk-gsoc/samples/notebook_closebtn.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/samples/notebook_closebtn.py	(original)
+++ sandbox/trunk/ttk-gsoc/samples/notebook_closebtn.py	Sat May 17 23:18:13 2008
@@ -11,23 +11,21 @@
 
 imgdir = os.path.join(os.path.dirname(__file__), 'img')
 i1 = Tkinter.PhotoImage("img_close", file=os.path.join(imgdir, 'close.gif'))
-i2 = Tkinter.PhotoImage("img_closeactive", 
+i2 = Tkinter.PhotoImage("img_closeactive",
     file=os.path.join(imgdir, 'close_active.gif'))
 i3 = Tkinter.PhotoImage("img_closepressed",
     file=os.path.join(imgdir, 'close_pressed.gif'))
 
 style = ttk.Style()
 
-style.element_create("close", "image", "img_close", 
+style.element_create("close", "image", "img_close",
     (("active", "pressed", "!disabled"), "img_closepressed"),
     (("active", "!disabled"), "img_closeactive"), border=8, sticky='')
 
-style.layout("ButtonNotebook", {
-    "ButtonNotebook.client": {"sticky": "nswe"}
-    })
-style.layout("ButtonNotebook.Tab", {
-    "ButtonNotebook.tab": {"sticky": "nswe", "children":
-        [("ButtonNotebook.padding", {"side": "top", "sticky": "nswe", 
+style.layout("ButtonNotebook", [("ButtonNotebook.client", {"sticky": "nswe"})])
+style.layout("ButtonNotebook.Tab", [
+    ("ButtonNotebook.tab", {"sticky": "nswe", "children":
+        [("ButtonNotebook.padding", {"side": "top", "sticky": "nswe",
                                      "children":
             [("ButtonNotebook.focus", {"side": "top", "sticky": "nswe",
                                        "children":
@@ -35,7 +33,8 @@
                  ("ButtonNotebook.close", {"side": "left", "sticky": ''})]
             })]
         })]
-    }})
+    })]
+)
 
 def btn_press(event):
     x, y, widget = event.x, event.y, event.widget
@@ -67,7 +66,7 @@
 root.bind_class("TNotebook", "<ButtonRelease-1>", btn_release)
 
 # create a ttk notebook with our custom style, and add some tabs to it
-nb = ttk.Notebook(style="ButtonNotebook", width=200, height=200)
+nb = ttk.Notebook(width=200, height=200, style="ButtonNotebook")
 nb.pressed_index = None
 f1 = Tkinter.Frame(nb, background="red")
 f2 = Tkinter.Frame(nb, background="green")

Modified: sandbox/trunk/ttk-gsoc/samples/roundframe.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/samples/roundframe.py	(original)
+++ sandbox/trunk/ttk-gsoc/samples/roundframe.py	Sat May 17 23:18:13 2008
@@ -89,8 +89,8 @@
 
 style.element_create("RoundedFrame", "image", "frameBorder",
     ("focus", "frameFocusBorder"), border=16, sticky="nsew")
-    
-style.layout("RoundedFrame", {"RoundedFrame": {"sticky": "nsew"}})
+
+style.layout("RoundedFrame", [("RoundedFrame", {"sticky": "nsew"})])
 style.configure("TEntry", borderwidth=0)
 
 frame = ttk.Frame(style="RoundedFrame", padding=10)

Modified: sandbox/trunk/ttk-gsoc/samples/theme_selector.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/samples/theme_selector.py	(original)
+++ sandbox/trunk/ttk-gsoc/samples/theme_selector.py	Sat May 17 23:18:13 2008
@@ -1,4 +1,4 @@
-"""Ttk Theme Selector v2. 
+"""Ttk Theme Selector v2.
 
 This is an improvement from the other theme selector (themes_combo.py)
 since now you can notice theme changes in Ttk Combobox, Ttk Frame,
@@ -12,7 +12,7 @@
 class App(ttk.Frame):
     def __init__(self):
         ttk.Frame.__init__(self, borderwidth=3)
-        
+
         self.style = ttk.Style()
 
         # XXX Ideally I wouldn't want to create a Tkinter.IntVar to make
@@ -35,11 +35,11 @@
         self.themes_combo.set(themes[0])
         self.themes_combo.bind("<<ComboboxSelected>>", self._theme_sel_changed)
 
-        change_btn = ttk.Button(self, text='Change Theme', 
+        change_btn = ttk.Button(self, text='Change Theme',
             command=self._change_theme)
-       
-        theme_change_checkbtn = ttk.Checkbutton(self, 
-            text="Change themes when combobox item is activated", 
+
+        theme_change_checkbtn = ttk.Checkbutton(self,
+            text="Change themes when combobox item is activated",
             variable=self.theme_autochange)
 
         themes_lbl.grid(ipadx=6, sticky="w")
@@ -54,7 +54,7 @@
         self.grid(row=0, column=0, sticky="nsew", columnspan=3, rowspan=2)
 
 
-def main(): 
+def main():
     app = App()
     app.master.title("Theme Selector")
     app.mainloop()

Modified: sandbox/trunk/ttk-gsoc/samples/treeview_multicolumn.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/samples/treeview_multicolumn.py	(original)
+++ sandbox/trunk/ttk-gsoc/samples/treeview_multicolumn.py	Sat May 17 23:18:13 2008
@@ -39,15 +39,15 @@
 
 class App(object):
     def __init__(self):
-        self.tree = None   
+        self.tree = None
         self._setup_widgets()
         self._build_tree()
-    
+
     def _setup_widgets(self):
-        msg = ttk.Label(wraplength="4i", justify="left", anchor="n", 
-            # XXX Change the following to a list, run it using tk 8.4 and 
+        msg = ttk.Label(wraplength="4i", justify="left", anchor="n",
+            # XXX Change the following to a list, run it using tk 8.4 and
             #     watch it segfault.
-            padding=(10, 2, 10, 6), 
+            padding=(10, 2, 10, 6),
             text=("Ttk is the new Tk themed widget set. One of the widgets it "
                   "includes is a tree widget, which can be configured to "
                   "display multiple columns of informational data without "
@@ -64,8 +64,8 @@
         # XXX Sounds like a good support class would be one for constructing
         #     a treeview with scrollbars.
         self.tree = ttk.Treeview(columns=tree_columns, show="headings")
-        vsb = Tkinter.Scrollbar(orient="vertical", command=self.tree.yview)
-        hsb = Tkinter.Scrollbar(orient="horizontal", command=self.tree.xview)
+        vsb = ttk.Scrollbar(orient="vertical", command=self.tree.yview)
+        hsb = ttk.Scrollbar(orient="horizontal", command=self.tree.xview)
         self.tree.configure(yscroll=vsb.set, xscroll=hsb.set)
         self.tree.grid_configure(**{'in': container})
         self.tree.grid(column=0, row=0, sticky='nsew')
@@ -79,10 +79,10 @@
 
     def _build_tree(self):
         for col in tree_columns:
-            self.tree.heading(col, text=col.title(), 
+            self.tree.heading(col, text=col.title(),
                 command=self.tree.register(
                     lambda c=col: sortby(self.tree, c, 0)))
-            # XXX tkFont.Font().measure expected args are incorrect according 
+            # XXX tkFont.Font().measure expected args are incorrect according
             #     to the Tk docs
             self.tree.column(col, width=tkFont.Font().measure(col.title()))
 
@@ -94,7 +94,7 @@
                 ilen = tkFont.Font().measure(val)
                 if self.tree.column(tree_columns[indx], width=None) < ilen:
                     self.tree.column(tree_columns[indx], width=ilen)
-    
+
 def main():
     root = Tkinter.Tk()
     root.wm_title("Multi-Column List")

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	Sat May 17 23:18:13 2008
@@ -2,13 +2,13 @@
 
 This module provides classes to allow using Tk themed widget set.
 
-Ttk is based on a revised and enhanced version of 
-TIP #48 (http://tip.tcl.tk/48) specified style engine. 
+Ttk is based on a revised and enhanced version of
+TIP #48 (http://tip.tcl.tk/48) specified style engine.
 
-Its basic idea is to separate, to the extent possible, the code 
-implementing a widget's behavior from the code implementing its 
-appearance. Widget class bindings are primarily responsible for 
-maintaining the widget state and invoking callbacks, all aspects 
+Its basic idea is to separate, to the extent possible, the code
+implementing a widget's behavior from the code implementing its
+appearance. Widget class bindings are primarily responsible for
+maintaining the widget state and invoking callbacks, all aspects
 of the widgets appearance lies at Themes.
 """
 
@@ -16,9 +16,9 @@
 
 __author__ = "Guilherme Polo <ggpolo at gmail.com>"
 
-__all__ = ["Button", "Checkbutton", "Combobox", "Entry", "Frame", 
-           "Label", "Labelframe", "LabelFrame", "Menubutton", "Notebook", 
-           "Panedwindow", "PanedWindow", "Progressbar", "Radiobutton", 
+__all__ = ["Button", "Checkbutton", "Combobox", "Entry", "Frame",
+           "Label", "Labelframe", "LabelFrame", "Menubutton", "Notebook",
+           "Panedwindow", "PanedWindow", "Progressbar", "Radiobutton",
            "Scrollbar", "Separator", "Sizegrip", "Style", "Treeview"]
 
 import Tkinter
@@ -27,11 +27,11 @@
 REQUIRE_TILE = True if Tkinter.TkVersion < 8.5 else False
 
 def _loadttk(loadtk):
-    # This extends the default Tkinter.Tk._loadtk method so we can be 
+    # This extends the default Tkinter.Tk._loadtk method so we can be
     # sure that Ttk is available for use, or not.
     def f(self):
         loadtk(self)
-        if REQUIRE_TILE: 
+        if REQUIRE_TILE:
             import os
             tilelib = os.environ.get('TILE_LIBRARY')
             if tilelib:
@@ -40,11 +40,11 @@
                 # command
                 self.tk.eval('global auto_path; '
                              'lappend auto_path {%s}' % tilelib)
-            # XXX Maybe I should catch a possible TclError and display 
-            #     a Warning telling Ttk won't be available ? Or maybe I 
+            # XXX Maybe I should catch a possible TclError and display
+            #     a Warning telling Ttk won't be available ? Or maybe I
             #     shouldn't even be doing all this.
             self.tk.eval('package require tile')
-    
+
     return f
 
 Tkinter.Tk._loadtk = _loadttk(Tkinter.Tk._loadtk)
@@ -52,7 +52,7 @@
 def _format_optdict(optdict, script=False, ignore=None):
     """Formats optdict to pass it to tk.call.
     
-    E.g. (script=False): 
+    E.g. (script=False):
       {'foreground': 'blue', 'padding': [1, 2, 3, 4]} returns:
       ('-foreground', 'blue', '-padding', '1 2 3 4')"""
     format = "%s" if not script else "{%s}"
@@ -81,7 +81,7 @@
     E.g. (script=False):
       {'background': [('active", 'white'), ('focus', 'blue')]} returns:
       ('-background', 'active white focus blue')"""
-    # if caller passes a Tcl script to tk.call, all the values need to 
+    # if caller passes a Tcl script to tk.call, all the values need to
     # be grouped into words (arguments to a command in Tcl dialect)
     format = "%s" if not script else "{%s}"
 
@@ -94,9 +94,9 @@
         for state, val in value:
             if not isinstance(state, basestring):
                 # lets believe it is a sequence and group these multiple states
-                state = "{%s}" % ' '.join(state) 
+                state = "{%s}" % ' '.join(state)
 
-            if not state: 
+            if not state:
                 # empty string in Python is equivalent to {} in Tcl, and it may
                 # be used to indicate the "normal" state
                 state = "{}"
@@ -108,14 +108,14 @@
             opt_val.append("%s %s" % (state, val))
 
         opts.append(("-%s" % opt, format % ' '.join(opt_val)))
-    
+
     return Tkinter._flatten(opts)
 
 def _format_elemcreate(etype, script=False, *args, **kw):
     """Formats args and kw according to the given element factory etype."""
     spec = None
     opts = ()
-    if etype in ("image", "vsapi"): 
+    if etype in ("image", "vsapi"):
         if etype == "image": # define an element based on an image
             # first arg should be the default image name
             iname = args[0]
@@ -124,10 +124,10 @@
             imagespec = _format_mapdict({None: args[1:]})[1]
             spec = "%s %s" % (iname, imagespec)
 
-        else: 
+        else:
             # define an element whose visual appearance is drawn using the
-            # Microsoft Visual Styles API which is responsible for the 
-            # themed styles on Windows XP and Vista. 
+            # Microsoft Visual Styles API which is responsible for the
+            # themed styles on Windows XP and Vista.
             # Availability: Tk 8.6, Windows XP and Vista.
             class_name, part_id = args[:2]
             statemap = _format_mapdict({None: args[2:]})[1]
@@ -141,28 +141,29 @@
         spec = args[0] # theme name
         if len(args) > 1: # elementfrom specified
             opts = (args[1], )
-    
+
     if script:
         spec = '{%s}' % spec
         opts = ' '.join(map(str, opts))
 
     return spec, opts
 
-def _format_layoutdict(layout, indent=2, child=False):
-    """Formats a layout dict so we can pass the result to ttk::style 
-    layout and ttk::style settings.
-    
+def _format_layoutlist(layout, indent=2, indent_size=2):
+    """Formats a layout list so we can pass the result to ttk::style
+    layout and ttk::style settings. Note that the layout doesn't has to
+    be a list necessarily.
+
     E.g.:
-      {"Menubutton.background": None,
-       "Menubutton.button": {"children": 
-           [("Menubutton.focus", {"children": 
-               [("Menubutton.padding", {"children": 
-                 [("Menubutton.label", {"side": "left", "expand": 1})]
+      [("Menubutton.background", None),
+       ("Menubutton.button", {"children":
+           [("Menubutton.focus", {"children":
+               [("Menubutton.padding", {"children":
+                [("Menubutton.label", {"side": "left", "expand": 1})]
                })]
            })]
-       },
-       "Menubutton.indicator": {"side": "right"}
-      }) 
+       }),
+       ("Menubutton.indicator", {"side": "right"})
+      ]
 
       returns:
 
@@ -177,36 +178,33 @@
       Menubutton.indicator -side right"""
     script = []
 
-    # If child is set, we will be dealing with subylayouts needing processing,
-    # otherwise we will try to find sublayouts for processing
-    layouts = layout.pop("children") if child else layout.iteritems()
-
-    for elem, opts in layouts:
+    for layout_elem in layout:
+        elem, opts = layout_elem
         opts = opts or {}
         fopts = ' '.join(map(str, _format_optdict(opts, True, "children")))
         head = "%s%s%s" % (' ' * indent, elem, (" %s" % fopts) if fopts else '')
 
         if "children" in opts:
             script.append(head + " -children {")
-            indent += 2
-            newscript, indent  = _format_layoutdict(opts, indent, True)
+            indent += indent_size
+            newscript, indent  = _format_layoutlist(opts['children'], indent)
             script.append(newscript)
-            indent -= 2
+            indent -= indent_size
             script.append('%s}' % (' ' * indent))
         else:
             script.append(head)
-    
+
     return '\n'.join(script), indent
 
 def _script_from_settings(settings):
-    """Returns an appropriate script, based on settings, according to 
-    theme_settings definition to be used by theme_settings and 
+    """Returns an appropriate script, based on settings, according to
+    theme_settings definition to be used by theme_settings and
     theme_create."""
     script = []
     # a script will be generated according to settings passed, which
     # will then be evaluated by Tcl
     for name, opts in settings.iteritems():
-        # will format specific keys according to Tcl code 
+        # will format specific keys according to Tcl code
         if opts.get('configure'): # format 'configure'
             s = ' '.join(map(str, _format_optdict(opts['configure'], True)))
             script.append("ttk::style configure %s %s;" % (name, s))
@@ -219,7 +217,7 @@
             if not opts['layout']:
                 s = 'null' # could be any other word, but this one makes sense
             else:
-                s, _ = _format_layoutdict(opts['layout'])
+                s, _ = _format_layoutlist(opts['layout'])
             script.append("ttk::style layout %s {\n%s\n}" % (name, s))
 
         if opts.get('element create'): # format 'element create'
@@ -240,10 +238,11 @@
             script.append("ttk::style element create %s %s %s %s" % (
                 name, etype, spec, opts))
 
+    print '\n'.join(script)
     return '\n'.join(script)
 
 def _dict_from_tcltuple(t, cut_minus=True):
-    """Break tuple in pairs, format it properly, then build the return 
+    """Break tuple in pairs, format it properly, then build the return
     dict.
 
     t is expected to contain an even number of elements."""
@@ -263,15 +262,16 @@
     # the supposed '-' prefixing options will be removed if cut_minus is True.
     return dict((opt[1 if cut_minus else 0:], val) for opt, val in opts)
 
-def _dict_from_layouttuple(t):
-    """Construct a dict from the tuple returned by ttk::layout, this is
-    the reverse of _format_layoutdict."""
-    res = {}
+def _list_from_layouttuple(t):
+    """Construct a list from the tuple returned by ttk::layout, this is
+    somewhat the reverse of _format_layoutlist."""
+    res = []
     indx = 0
 
     while indx < len(t):
         name = t[indx]
-        res[name] = {}
+        opts = {}
+        res.append((name, opts))
         indx += 1
 
         # grab name's options
@@ -284,18 +284,17 @@
             indx += 2
 
             if opt == 'children':
-                ch = _dict_from_layouttuple(val)
-                val = [ch.items()[0]]
+                val = _list_from_layouttuple(val)
 
-            res[name][opt] = val
+            opts[opt] = val
 
     return res
 
 def _val_or_dict(options, func, *args):
-    """Format options then call func with args and options and return 
+    """Format options then call func with args and options and return
     the appropriate result.
 
-    If no option is specified, a dict is returned. If a option is 
+    If no option is specified, a dict is returned. If a option is
     specified with the None value, the value for that option is returned.
     Otherwise, the function just sets the passed options and the caller
     shouldn't be expecting a return value anyway."""
@@ -310,22 +309,22 @@
 
 class Style(object):
     """Manipulate style database."""
-   
+
     _name = "ttk::style"
 
     def __init__(self, master=None):
         if not master:
             if not Tkinter._default_root:
                 Tkinter._default_root = Tkinter.Tk()
-            master = Tkinter._default_root 
+            master = Tkinter._default_root
 
         self.tk = master.tk
 
 
     def configure(self, style, **kw):
-        """Query or sets the default value of the specified option(s) in 
+        """Query or sets the default value of the specified option(s) in
         style.
-        
+
         Each key in kw is an option and each value is either a string or
         a sequence identifying the value for that option."""
         return _dict_from_tcltuple(self.tk.call(self._name, "configure", style,
@@ -333,23 +332,23 @@
 
 
     def map(self, style, **kw):
-        """Query or sets dynamic values of the specified option(s) in 
+        """Query or 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 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 
-        states is expected to be a sequence, otherwise a single string 
+        and a value, grouped in yet another sequence. Note that a group of
+        states is expected to be a sequence, otherwise a single string
         should be passed as state."""
-        return _dict_from_tcltuple(self.tk.call(self._name, "map", style, 
+        return _dict_from_tcltuple(self.tk.call(self._name, "map", style,
                                                 *(_format_mapdict(kw))))
 
 
     def lookup(self, style, option, state=None, default=None):
         """Returns the value specified for option in style.
 
-        If state is specified it is expected to be a sequence of one 
-        or more states. If the default argument is set, it is used as 
+        If state is specified it is expected to be a sequence of one
+        or more states. If the default argument is set, it is used as
         a fallback value in case no specification for option is found."""
         state = ' '.join(state) if state else ''
 
@@ -362,46 +361,47 @@
     def layout(self, style, layoutspec=None):
         """Define the widget layout for given style. If layoutspec is
         omitted, return the layout specification for given style.
-        
-        layoutspec is expected to be a dict or an object different than
-        None that evaluates to False if you want to "turn off" that style. 
-        If it is a dict, each key should be a layout name and each value 
+
+        layoutspec is expected to be a list or an object different than
+        None that evaluates to False if you want to "turn off" that style.
+        If it is a list (or tuple, or something else), each item should be
+        a tuple where the first item is the layout name and the second item
         should have the format described below:
 
         LAYOUTS
-            
+
             A layout can contain the value None, if takes no options, or
-            another dict of options specifying how to arrange the element.
+            a dict of options specifying how to arrange the element.
             The layout mechanism uses a simplified version of the pack
             geometry manager: given an initial cavity, each element is
             allocated a parcel. Valid options/values are:
 
                 side: whichside
-                    Specifies which side of the cavity to place the 
-                    element; one of top, right, bottom or left. If 
+                    Specifies which side of the cavity to place the
+                    element; one of top, right, bottom or left. If
                     omitted, the element occupies the entire cavity.
 
                 sticky: nswe
-                    Specifies where the element is placed inside its 
+                    Specifies where the element is placed inside its
                     allocated parcel.
 
                 children: [sublayout... ]
-                    Specifies a list of elements to place inside the 
+                    Specifies a list of elements to place inside the
                     element. Each element is a tuple (or other sequence)
                     where the first item is the layout name, and the other
                     is a LAYOUT."""
         lspec = None
         if layoutspec:
-            lspec = _format_layoutdict(layoutspec)[0]
+            lspec = _format_layoutlist(layoutspec)[0]
         elif layoutspec is not None: # will disable the layout ({}, '', etc)
             lspec = "null" # could be any other word, but this may make sense
                            # when calling layout(style) later
-      
-        return _dict_from_layouttuple(self.tk.call(self._name, "layout", style,
+
+        return _list_from_layouttuple(self.tk.call(self._name, "layout", style,
                                                    lspec))
 
 
-    def element_create(self, elementname, etype, *args, **kw): 
+    def element_create(self, elementname, etype, *args, **kw):
         """Create a new element in the current theme of given etype."""
         spec, opts = _format_elemcreate(etype, False, *args, **kw)
         self.tk.call(self._name, "element", "create", elementname, etype,
@@ -421,17 +421,17 @@
     def theme_create(self, themename, parent=None, settings=None):
         """Creates a new theme.
 
-        It is an error if themename already exists. If parent is 
-        specified, the new theme will inherit styles, elements and 
+        It is an error if themename already exists. If parent is
+        specified, the new theme will inherit styles, elements and
         layouts from the specified parent theme. If settings are present,
         they are expected to have the same syntax used for theme_settings."""
         script = _script_from_settings(settings) if settings else ''
-    
+
         if parent:
             self.tk.call(self._name, "theme", "create", themename,
                          "-parent", parent, "-settings", script)
         else:
-            self.tk.call(self._name, "theme", "create", themename, 
+            self.tk.call(self._name, "theme", "create", themename,
                          "-settings", script)
 
 
@@ -439,9 +439,9 @@
         """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 
+        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
         configure, map, layout and element_create respectively."""
         script = _script_from_settings(settings)
         self.tk.call(self._name, "theme", "settings", themename, script)
@@ -482,9 +482,9 @@
         """
         Tkinter.Widget.__init__(self, master, widgetname, cnf, kw, extra)
 
-    
+
     def identify(self, x, y):
-        """Returns the name of the element at position x, y, or the empty 
+        """Returns the name of the element at position x, y, or the empty
         string if the point does not lie within any element.
 
         x and y are pixel coordinates relative to the widget."""
@@ -492,11 +492,11 @@
 
 
     def instate(self, statespec, callback=None, *args):
-        """Test the widget's state. 
+        """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 
+        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
         statespec. statespec is expected to be a sequence."""
         ret = self.tk.call(self._w, "instate", ' '.join(statespec))
         if ret and callback:
@@ -519,7 +519,7 @@
 
 
 class Button(Widget):
-    """Ttk Button widget, displays a textual label and/or image, and 
+    """Ttk Button widget, displays a textual label and/or image, and
     evaluates a command when pressed."""
 
     def __init__(self, master=None, cnf={}, **kw):
@@ -556,10 +556,10 @@
 
 
     def invoke(self):
-        """Toggles between the selected and deselected states and 
-        invokes the associated command. If the widget is currently 
-        selected, sets the option variable to the offvalue option 
-        and deselects the widget; otherwise, sets the option variable 
+        """Toggles between the selected and deselected states and
+        invokes the associated command. If the widget is currently
+        selected, sets the option variable to the offvalue option
+        and deselects the widget; otherwise, sets the option variable
         to the option onvalue.
 
         Returns the result of the associated command."""
@@ -567,7 +567,7 @@
 
 
 class Entry(Widget, Tkinter.Entry):
-    """Ttk Entry widget displays a one-line text string and allows that 
+    """Ttk Entry widget displays a one-line text string and allows that
     string to be edited by the user."""
 
     def __init__(self, master=None, cnf={}, **kw):
@@ -596,20 +596,20 @@
 
 
     def identify(self, x, y):
-        """Returns the name of the element at position x, y, or the 
+        """Returns the name of the element at position x, y, or the
         empty string if the coordinates are outside the window."""
         return self.tk.call(self._w, "identify", x, y)
 
 
     def validate(self):
-        """Force revalidation, independent of the conditions specified 
-        by the validate option. Returns 0 if validation fails, 1 if it 
+        """Force revalidation, independent of the conditions specified
+        by the validate option. Returns 0 if validation fails, 1 if it
         succeeds. Sets or clears the invalid state accordingly."""
         return self.tk.call(self._w, "validate")
 
 
 class Combobox(Entry):
-    """Ttk Combobox widget combines a text field with a pop-down list of 
+    """Ttk Combobox widget combines a text field with a pop-down list of
     values."""
 
     def __init__(self, master=None, cnf={}, **kw):
@@ -621,16 +621,16 @@
 
         WIDGET-SPECIFIC OPTIONS
 
-            exportselection, justify, height, postcommand, state, 
+            exportselection, justify, height, postcommand, state,
             textvariable, values, width
         """
         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, 
-        returns the index of the current value in the list of values 
+        """If newindex is supplied, sets the combobox value to the
+        element at position newindex in the list of values. Otherwise,
+        returns the index of the current value in the list of values
         or -1 if the current value does not appear in the list."""
         return self.tk.call(self._w, "current", newindex)
 
@@ -641,7 +641,7 @@
 
 
 class Frame(Widget):
-    """Ttk Frame widget is a container, used to group other widgets 
+    """Ttk Frame widget is a container, used to group other widgets
     together."""
 
     def __init__(self, master=None, cnf={}, **kw):
@@ -660,12 +660,12 @@
 
 class Label(Widget):
     """Ttk Label widget displays a textual label and/or image."""
-    
+
     def __init__(self, master=None, cnf={}, **kw):
         """Construct a Ttk Label with parent master.
 
         STANDARD OPTIONS
-            
+
             class, compound, cursor, image, style, takefocus, text,
             textvariable, underline, width
 
@@ -707,7 +707,7 @@
 
         STANDARD OPTIONS
 
-            class, compound, cursor, image, state, style, takefocus, 
+            class, compound, cursor, image, state, style, takefocus,
             text, textvariable, underline, width
 
         WIDGET-SPECIFIC OPTIONS
@@ -746,7 +746,7 @@
                 * The name of a child window
                 * A positional specification of the form "@x,y", which
                   defines the tab
-                * The string "current", which identifies the 
+                * The string "current", which identifies the
                   currently-selected tab
                 * The string "end", which returns the number of tabs (only
                   valid for method index)
@@ -778,7 +778,7 @@
 
 
     def identify(self, x, y):
-        """Returns the name of the tab element at position x, y, or the 
+        """Returns the name of the tab element at position x, y, or the
         empty string if none."""
         return self.tk.call(self._w, "identify", x, y)
 
@@ -793,7 +793,7 @@
         """Inserts a pane at the specified position.
 
         pos is either the string end, an integer index, or the name of
-        a managed child. If child is already managed by the notebook, 
+        a managed child. If child is already managed by the notebook,
         moves it to the specified position."""
         self.tk.call(self._w, "insert", pos, child, *(_format_optdict(kw)))
 
@@ -801,7 +801,7 @@
     def select(self, tab_id=None):
         """Selects the specified tab.
 
-        The associated child window will be displayed, and the 
+        The associated child window will be displayed, and the
         previously-selected window (if different) is unmapped. If tab_id
         is omitted, returns the widget name of the currently selected
         pane."""
@@ -828,8 +828,8 @@
 
         This will extend the bindings for the toplevel window containing
         this notebook as follows:
-            
-            Control-Tab: selects the tab following the currently selected 
+
+            Control-Tab: selects the tab following the currently selected
                          one
 
             Shift-Control-Tab: selects the tab preceding the currently
@@ -840,7 +840,7 @@
 
         Multiple notebooks in a single toplevel may be enabled for
         traversal, including nested notebooks. However, notebook traversal
-        only works properly if all panes are direct children of the 
+        only works properly if all panes are direct children of the
         notebook."""
         # The only, and good, difference I see is about mnemonics, which works
         # after calling this method. Control-Tab and Shift-Control-Tab always
@@ -864,7 +864,7 @@
             orient, width, height
 
         PANE OPTIONS
-            
+
             weight
         """
         Widget.__init__(self, master, "ttk::panedwindow", cnf, kw)
@@ -884,8 +884,8 @@
 
     def pane(self, pane, **kw):
         """Query or modify the options of the specified pane.
-        
-        pane is either an integer index or the name of a managed 
+
+        pane is either an integer index or the name of a managed
         subwindow. If no options are specified, returns a dict of the
         pane option values, if an option is specified without a value,
         returns the value of that option. Otherwise, the options are set."""
@@ -895,7 +895,7 @@
     def sashpos(self, index, newpos=None):
         """If newpos is specified, sets the position of sash number index.
 
-        May adjust the positions of adjacent sashes to ensure that 
+        May adjust the positions of adjacent sashes to ensure that
         positions are monotonically increasing. Sash positions are further
         constrained to be between 0 and the total size of the widget.
 
@@ -906,7 +906,7 @@
 
 
 class Progressbar(Widget):
-    """Ttk Progressbar widget shows the status of a long-running 
+    """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
@@ -916,7 +916,7 @@
         """Construct a Ttk Progressbar with parent master.
 
         STANDARD OPTIONS
-            
+
             class, cursor, style, takefocus
 
         WIDGET-SPECIFIC OPTIONS
@@ -1018,7 +1018,7 @@
         """Construct a Ttk Sizegrip with parent master.
 
         STANDARD OPTIONS
-            
+
             class, cursor, state, style, takefocus
         """
         Widget.__init__(self, master, "ttk::sizegrip", cnf, kw)
@@ -1036,7 +1036,7 @@
 
         STANDARD OPTIONS
 
-            class, cursor, style, takefocus, xscrollcommand, 
+            class, cursor, style, takefocus, xscrollcommand,
             yscrollcommand
 
         WIDGET-SPECIFIC OPTIONS
@@ -1055,11 +1055,11 @@
 
 
     def bbox(self, 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. 
-        
+        """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 
+        If the item is not visible (i.e., if it is a descendant of a
         closed item or is scrolled offscreen), returns an empty string."""
         return self.tk.call(self._w, "bbox", item, column)
 
@@ -1073,14 +1073,14 @@
         """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 
+        are detached from tree. No items in newchildren may be an
         ancestor of item."""
         self.tk.call(self._w, "children", item, newchildren)
 
 
     def column(self, column, **kw):
-        """Query or modify the options for the specified column. 
-        
+        """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
@@ -1098,13 +1098,13 @@
         """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 
+        be reinserted at another point in the tree, but will not be
         displayed. The root item may not be detached."""
         self.tk.call(self._w, "detach", items)
 
 
     def exists(self, item):
-        """Returns 1 if the specified item is present in the three, 
+        """Returns 1 if the specified item is present in the three,
         0 otherwise."""
         return self.tk.call(self._w, "exists", item)
 
@@ -1124,7 +1124,7 @@
             image: image_name
                 Specifies an image to display to the right of the column
                 heading
-            anchor: anchor  
+            anchor: anchor
                 Specifies how the heading text should be aligned. One of
                 the standard Tk anchor values
             command: script
@@ -1133,7 +1133,7 @@
 
         To configure the tree column heading, call this with column = "#0" """
         return self.tk.call(self._w, "heading", column, *(_format_optdict(kw)))
-    
+
 
     def identify(self, component, x, y):
         """Returns a description of the specified component under the
@@ -1164,22 +1164,22 @@
         """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 
+        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 
+        is specified, it is used as the item identifier, iid must not
         already exist in the tree. Otherwise, a new unique identifier
         is generated."""
         opts, values = _format_optdict(kw, ignore='values'), kw.get('values')
         # values may need special formatting if any value contain a space
         if values:
-            opts += ("-values", 
+            opts += ("-values",
                 ' '.join(('{%s}' if ' ' in v else '%s') % v for v in values))
         if iid:
-            res = self.tk.call(self._w, "insert", parent, index, "-id", iid, 
+            res = self.tk.call(self._w, "insert", parent, index, "-id", iid,
                                *opts)
         else:
             res = self.tk.call(self._w, "insert", parent, index, *opts)
@@ -1188,11 +1188,11 @@
 
 
     def item(self, item, **kw):
-        """Query or modify the options for the specified item. 
-        
+        """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 
+        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."""
         return _val_or_dict(kw, self.tk.call, self._w, "item", item)
 
@@ -1201,7 +1201,7 @@
         """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 
+        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."""
         self.tk.call(self._w, "move", item, parent, index)
@@ -1222,16 +1222,16 @@
 
 
     def prev(self, item):
-        """Returns the identifier of item's previous sibling, or '' if 
+        """Returns the identifier of item's previous sibling, or '' if
         item is the first child of its parent."""
         return self.tk.call(self._w, "prev", item)
 
 
     def see(self, item):
         """Ensure that item is visible.
-        
-        Sets all of item's ancestors open option to True, and scrolls 
-        the widget if necessary so that item is within the visible 
+
+        Sets all of item's ancestors open option to True, and scrolls
+        the widget if necessary so that item is within the visible
         portion of the tree."""
         self.tk.call(self._w, "see", item)
 
@@ -1286,13 +1286,13 @@
     def tag_configure(self, tagname, **kw):
         """Query or modify the options for the specified tagname.
 
-        If one or more option/value pairs are specified, sets the value 
+        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."""
-        return _val_or_dict(kw, self.tk.call, self._w, "tag", "configure", 
+        return _val_or_dict(kw, self.tk.call, self._w, "tag", "configure",
                             tagname)
 
 

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	Sat May 17 23:18:13 2008
@@ -2,13 +2,13 @@
 
 This module provides classes to allow using Tk themed widget set.
 
-Ttk is based on a revised and enhanced version of 
-TIP #48 (http://tip.tcl.tk/48) specified style engine. 
+Ttk is based on a revised and enhanced version of
+TIP #48 (http://tip.tcl.tk/48) specified style engine.
 
-Its basic idea is to separate, to the extent possible, the code 
-implementing a widget's behavior from the code implementing its 
-appearance. Widget class bindings are primarily responsible for 
-maintaining the widget state and invoking callbacks, all aspects 
+Its basic idea is to separate, to the extent possible, the code
+implementing a widget's behavior from the code implementing its
+appearance. Widget class bindings are primarily responsible for
+maintaining the widget state and invoking callbacks, all aspects
 of the widgets appearance lies at Themes.
 """
 
@@ -16,22 +16,22 @@
 
 __author__ = "Guilherme Polo <ggpolo at gmail.com>"
 
-__all__ = ["Button", "Checkbutton", "Combobox", "Entry", "Frame", 
-           "Label", "Labelframe", "LabelFrame", "Menubutton", "Notebook", 
-           "Panedwindow", "PanedWindow", "Progressbar", "Radiobutton", 
+__all__ = ["Button", "Checkbutton", "Combobox", "Entry", "Frame",
+           "Label", "Labelframe", "LabelFrame", "Menubutton", "Notebook",
+           "Panedwindow", "PanedWindow", "Progressbar", "Radiobutton",
            "Scrollbar", "Separator", "Sizegrip", "Style", "Treeview"]
 
-import Tkinter
+import tkinter
 
 # Verify if Tk is new enough to not need Tile checking
-REQUIRE_TILE = True if Tkinter.TkVersion < 8.5 else False
+REQUIRE_TILE = True if tkinter.TkVersion < 8.5 else False
 
 def _loadttk(loadtk):
-    # This extends the default Tkinter.Tk._loadtk method so we can be 
+    # This extends the default tkinter.Tk._loadtk method so we can be
     # sure that Ttk is available for use, or not.
     def f(self):
         loadtk(self)
-        if REQUIRE_TILE: 
+        if REQUIRE_TILE:
             import os
             tilelib = os.environ.get('TILE_LIBRARY')
             if tilelib:
@@ -40,19 +40,19 @@
                 # command
                 self.tk.eval('global auto_path; '
                              'lappend auto_path {%s}' % tilelib)
-            # XXX Maybe I should catch a possible TclError and display 
-            #     a Warning telling Ttk won't be available ? Or maybe I 
+            # XXX Maybe I should catch a possible TclError and display
+            #     a Warning telling Ttk won't be available ? Or maybe I
             #     shouldn't even be doing all this.
             self.tk.eval('package require tile')
-    
+
     return f
 
-Tkinter.Tk._loadtk = _loadttk(Tkinter.Tk._loadtk)
+tkinter.Tk._loadtk = _loadttk(tkinter.Tk._loadtk)
 
 def _format_optdict(optdict, script=False, ignore=None):
     """Formats optdict to pass it to tk.call.
     
-    E.g. (script=False): 
+    E.g. (script=False):
       {'foreground': 'blue', 'padding': [1, 2, 3, 4]} returns:
       ('-foreground', 'blue', '-padding', '1 2 3 4')"""
     format = "%s" if not script else "{%s}"
@@ -73,7 +73,7 @@
 
         opts.append(("-%s" % opt, value))
 
-    return Tkinter._flatten(opts)
+    return tkinter._flatten(opts)
 
 def _format_mapdict(mapdict, script=False):
     """Formats mapdict to pass it to tk.call.
@@ -81,7 +81,7 @@
     E.g. (script=False):
       {'background': [('active", 'white'), ('focus', 'blue')]} returns:
       ('-background', 'active white focus blue')"""
-    # if caller passes a Tcl script to tk.call, all the values need to 
+    # if caller passes a Tcl script to tk.call, all the values need to
     # be grouped into words (arguments to a command in Tcl dialect)
     format = "%s" if not script else "{%s}"
 
@@ -94,9 +94,9 @@
         for state, val in value:
             if not isinstance(state, str):
                 # lets believe it is a sequence and group these multiple states
-                state = "{%s}" % ' '.join(state) 
+                state = "{%s}" % ' '.join(state)
 
-            if not state: 
+            if not state:
                 # empty string in Python is equivalent to {} in Tcl, and it may
                 # be used to indicate the "normal" state
                 state = "{}"
@@ -108,14 +108,14 @@
             opt_val.append("%s %s" % (state, val))
 
         opts.append(("-%s" % opt, format % ' '.join(opt_val)))
-    
-    return Tkinter._flatten(opts)
+
+    return tkinter._flatten(opts)
 
 def _format_elemcreate(etype, script=False, *args, **kw):
     """Formats args and kw according to the given element factory etype."""
     spec = None
     opts = ()
-    if etype in ("image", "vsapi"): 
+    if etype in ("image", "vsapi"):
         if etype == "image": # define an element based on an image
             # first arg should be the default image name
             iname = args[0]
@@ -124,10 +124,10 @@
             imagespec = _format_mapdict({None: args[1:]})[1]
             spec = "%s %s" % (iname, imagespec)
 
-        else: 
+        else:
             # define an element whose visual appearance is drawn using the
-            # Microsoft Visual Styles API which is responsible for the 
-            # themed styles on Windows XP and Vista. 
+            # Microsoft Visual Styles API which is responsible for the
+            # themed styles on Windows XP and Vista.
             # Availability: Tk 8.6, Windows XP and Vista.
             class_name, part_id = args[:2]
             statemap = _format_mapdict({None: args[2:]})[1]
@@ -141,28 +141,29 @@
         spec = args[0] # theme name
         if len(args) > 1: # elementfrom specified
             opts = (args[1], )
-    
+
     if script:
         spec = '{%s}' % spec
         opts = ' '.join(map(str, opts))
 
     return spec, opts
 
-def _format_layoutdict(layout, indent=2, child=False):
-    """Formats a layout dict so we can pass the result to ttk::style 
-    layout and ttk::style settings.
-    
+def _format_layoutlist(layout, indent=2, indent_size=2):
+    """Formats a layout list so we can pass the result to ttk::style
+    layout and ttk::style settings. Note that the layout doesn't has to
+    be a list necessarily.
+
     E.g.:
-      {"Menubutton.background": None,
-       "Menubutton.button": {"children": 
-           [("Menubutton.focus", {"children": 
-               [("Menubutton.padding", {"children": 
-                 [("Menubutton.label", {"side": "left", "expand": 1})]
+      [("Menubutton.background", None),
+       ("Menubutton.button", {"children":
+           [("Menubutton.focus", {"children":
+               [("Menubutton.padding", {"children":
+                [("Menubutton.label", {"side": "left", "expand": 1})]
                })]
            })]
-       },
-       "Menubutton.indicator": {"side": "right"}
-      }) 
+       }),
+       ("Menubutton.indicator", {"side": "right"})
+      ]
 
       returns:
 
@@ -177,36 +178,33 @@
       Menubutton.indicator -side right"""
     script = []
 
-    # If child is set, we will be dealing with subylayouts needing processing,
-    # otherwise we will try to find sublayouts for processing
-    layouts = layout.pop("children") if child else iter(layout.items())
-
-    for elem, opts in layouts:
+    for layout_elem in layout:
+        elem, opts = layout_elem
         opts = opts or {}
         fopts = ' '.join(map(str, _format_optdict(opts, True, "children")))
         head = "%s%s%s" % (' ' * indent, elem, (" %s" % fopts) if fopts else '')
 
         if "children" in opts:
             script.append(head + " -children {")
-            indent += 2
-            newscript, indent  = _format_layoutdict(opts, indent, True)
+            indent += indent_size
+            newscript, indent  = _format_layoutlist(opts['children'], indent)
             script.append(newscript)
-            indent -= 2
+            indent -= indent_size
             script.append('%s}' % (' ' * indent))
         else:
             script.append(head)
-    
+
     return '\n'.join(script), indent
 
 def _script_from_settings(settings):
-    """Returns an appropriate script, based on settings, according to 
-    theme_settings definition to be used by theme_settings and 
+    """Returns an appropriate script, based on settings, according to
+    theme_settings definition to be used by theme_settings and
     theme_create."""
     script = []
     # a script will be generated according to settings passed, which
     # will then be evaluated by Tcl
     for name, opts in settings.items():
-        # will format specific keys according to Tcl code 
+        # will format specific keys according to Tcl code
         if opts.get('configure'): # format 'configure'
             s = ' '.join(map(str, _format_optdict(opts['configure'], True)))
             script.append("ttk::style configure %s %s;" % (name, s))
@@ -219,7 +217,7 @@
             if not opts['layout']:
                 s = 'null' # could be any other word, but this one makes sense
             else:
-                s, _ = _format_layoutdict(opts['layout'])
+                s, _ = _format_layoutlist(opts['layout'])
             script.append("ttk::style layout %s {\n%s\n}" % (name, s))
 
         if opts.get('element create'): # format 'element create'
@@ -240,10 +238,11 @@
             script.append("ttk::style element create %s %s %s %s" % (
                 name, etype, spec, opts))
 
+    print('\n'.join(script))
     return '\n'.join(script)
 
 def _dict_from_tcltuple(t, cut_minus=True):
-    """Break tuple in pairs, format it properly, then build the return 
+    """Break tuple in pairs, format it properly, then build the return
     dict.
 
     t is expected to contain an even number of elements."""
@@ -263,15 +262,16 @@
     # the supposed '-' prefixing options will be removed if cut_minus is True.
     return dict((opt[1 if cut_minus else 0:], val) for opt, val in opts)
 
-def _dict_from_layouttuple(t):
-    """Construct a dict from the tuple returned by ttk::layout, this is
-    the reverse of _format_layoutdict."""
-    res = {}
+def _list_from_layouttuple(t):
+    """Construct a list from the tuple returned by ttk::layout, this is
+    somewhat the reverse of _format_layoutlist."""
+    res = []
     indx = 0
 
     while indx < len(t):
         name = t[indx]
-        res[name] = {}
+        opts = {}
+        res.append((name, opts))
         indx += 1
 
         # grab name's options
@@ -284,18 +284,17 @@
             indx += 2
 
             if opt == 'children':
-                ch = _dict_from_layouttuple(val)
-                val = [list(ch.items())[0]]
+                val = _list_from_layouttuple(val)
 
-            res[name][opt] = val
+            opts[opt] = val
 
     return res
 
 def _val_or_dict(options, func, *args):
-    """Format options then call func with args and options and return 
+    """Format options then call func with args and options and return
     the appropriate result.
 
-    If no option is specified, a dict is returned. If a option is 
+    If no option is specified, a dict is returned. If a option is
     specified with the None value, the value for that option is returned.
     Otherwise, the function just sets the passed options and the caller
     shouldn't be expecting a return value anyway."""
@@ -310,22 +309,22 @@
 
 class Style(object):
     """Manipulate style database."""
-   
+
     _name = "ttk::style"
 
     def __init__(self, master=None):
         if not master:
-            if not Tkinter._default_root:
-                Tkinter._default_root = Tkinter.Tk()
-            master = Tkinter._default_root 
+            if not tkinter._default_root:
+                tkinter._default_root = tkinter.Tk()
+            master = tkinter._default_root
 
         self.tk = master.tk
 
 
     def configure(self, style, **kw):
-        """Query or sets the default value of the specified option(s) in 
+        """Query or sets the default value of the specified option(s) in
         style.
-        
+
         Each key in kw is an option and each value is either a string or
         a sequence identifying the value for that option."""
         return _dict_from_tcltuple(self.tk.call(self._name, "configure", style,
@@ -333,23 +332,23 @@
 
 
     def map(self, style, **kw):
-        """Query or sets dynamic values of the specified option(s) in 
+        """Query or 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 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 
-        states is expected to be a sequence, otherwise a single string 
+        and a value, grouped in yet another sequence. Note that a group of
+        states is expected to be a sequence, otherwise a single string
         should be passed as state."""
-        return _dict_from_tcltuple(self.tk.call(self._name, "map", style, 
+        return _dict_from_tcltuple(self.tk.call(self._name, "map", style,
                                                 *(_format_mapdict(kw))))
 
 
     def lookup(self, style, option, state=None, default=None):
         """Returns the value specified for option in style.
 
-        If state is specified it is expected to be a sequence of one 
-        or more states. If the default argument is set, it is used as 
+        If state is specified it is expected to be a sequence of one
+        or more states. If the default argument is set, it is used as
         a fallback value in case no specification for option is found."""
         state = ' '.join(state) if state else ''
 
@@ -362,46 +361,47 @@
     def layout(self, style, layoutspec=None):
         """Define the widget layout for given style. If layoutspec is
         omitted, return the layout specification for given style.
-        
-        layoutspec is expected to be a dict or an object different than
-        None that evaluates to False if you want to "turn off" that style. 
-        If it is a dict, each key should be a layout name and each value 
+
+        layoutspec is expected to be a list or an object different than
+        None that evaluates to False if you want to "turn off" that style.
+        If it is a list (or tuple, or something else), each item should be
+        a tuple where the first item is the layout name and the second item
         should have the format described below:
 
         LAYOUTS
-            
+
             A layout can contain the value None, if takes no options, or
-            another dict of options specifying how to arrange the element.
+            a dict of options specifying how to arrange the element.
             The layout mechanism uses a simplified version of the pack
             geometry manager: given an initial cavity, each element is
             allocated a parcel. Valid options/values are:
 
                 side: whichside
-                    Specifies which side of the cavity to place the 
-                    element; one of top, right, bottom or left. If 
+                    Specifies which side of the cavity to place the
+                    element; one of top, right, bottom or left. If
                     omitted, the element occupies the entire cavity.
 
                 sticky: nswe
-                    Specifies where the element is placed inside its 
+                    Specifies where the element is placed inside its
                     allocated parcel.
 
                 children: [sublayout... ]
-                    Specifies a list of elements to place inside the 
+                    Specifies a list of elements to place inside the
                     element. Each element is a tuple (or other sequence)
                     where the first item is the layout name, and the other
                     is a LAYOUT."""
         lspec = None
         if layoutspec:
-            lspec = _format_layoutdict(layoutspec)[0]
+            lspec = _format_layoutlist(layoutspec)[0]
         elif layoutspec is not None: # will disable the layout ({}, '', etc)
             lspec = "null" # could be any other word, but this may make sense
                            # when calling layout(style) later
-      
-        return _dict_from_layouttuple(self.tk.call(self._name, "layout", style,
+
+        return _list_from_layouttuple(self.tk.call(self._name, "layout", style,
                                                    lspec))
 
 
-    def element_create(self, elementname, etype, *args, **kw): 
+    def element_create(self, elementname, etype, *args, **kw):
         """Create a new element in the current theme of given etype."""
         spec, opts = _format_elemcreate(etype, False, *args, **kw)
         self.tk.call(self._name, "element", "create", elementname, etype,
@@ -421,17 +421,17 @@
     def theme_create(self, themename, parent=None, settings=None):
         """Creates a new theme.
 
-        It is an error if themename already exists. If parent is 
-        specified, the new theme will inherit styles, elements and 
+        It is an error if themename already exists. If parent is
+        specified, the new theme will inherit styles, elements and
         layouts from the specified parent theme. If settings are present,
         they are expected to have the same syntax used for theme_settings."""
         script = _script_from_settings(settings) if settings else ''
-    
+
         if parent:
             self.tk.call(self._name, "theme", "create", themename,
                          "-parent", parent, "-settings", script)
         else:
-            self.tk.call(self._name, "theme", "create", themename, 
+            self.tk.call(self._name, "theme", "create", themename,
                          "-settings", script)
 
 
@@ -439,9 +439,9 @@
         """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 
+        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
         configure, map, layout and element_create respectively."""
         script = _script_from_settings(settings)
         self.tk.call(self._name, "theme", "settings", themename, script)
@@ -457,7 +457,7 @@
         self.tk.call(self._name, "theme", "use", themename)
 
 
-class Widget(Tkinter.Widget):
+class Widget(tkinter.Widget):
     """Base class for Tk themed widgets."""
 
     def __init__(self, master, widgetname, cnf={}, kw={}, extra=()):
@@ -480,11 +480,11 @@
             active, disabled, focus, pressed, selected, background,
             readonly, alternate, invalid
         """
-        Tkinter.Widget.__init__(self, master, widgetname, cnf, kw, extra)
+        tkinter.Widget.__init__(self, master, widgetname, cnf, kw, extra)
+
 
-    
     def identify(self, x, y):
-        """Returns the name of the element at position x, y, or the empty 
+        """Returns the name of the element at position x, y, or the empty
         string if the point does not lie within any element.
 
         x and y are pixel coordinates relative to the widget."""
@@ -492,11 +492,11 @@
 
 
     def instate(self, statespec, callback=None, *args):
-        """Test the widget's state. 
+        """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 
+        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
         statespec. statespec is expected to be a sequence."""
         ret = self.tk.call(self._w, "instate", ' '.join(statespec))
         if ret and callback:
@@ -519,7 +519,7 @@
 
 
 class Button(Widget):
-    """Ttk Button widget, displays a textual label and/or image, and 
+    """Ttk Button widget, displays a textual label and/or image, and
     evaluates a command when pressed."""
 
     def __init__(self, master=None, cnf={}, **kw):
@@ -556,18 +556,18 @@
 
 
     def invoke(self):
-        """Toggles between the selected and deselected states and 
-        invokes the associated command. If the widget is currently 
-        selected, sets the option variable to the offvalue option 
-        and deselects the widget; otherwise, sets the option variable 
+        """Toggles between the selected and deselected states and
+        invokes the associated command. If the widget is currently
+        selected, sets the option variable to the offvalue option
+        and deselects the widget; otherwise, sets the option variable
         to the option onvalue.
 
         Returns the result of the associated command."""
         return self.tk.call(self._w, "invoke")
 
 
-class Entry(Widget, Tkinter.Entry):
-    """Ttk Entry widget displays a one-line text string and allows that 
+class Entry(Widget, tkinter.Entry):
+    """Ttk Entry widget displays a one-line text string and allows that
     string to be edited by the user."""
 
     def __init__(self, master=None, cnf={}, **kw):
@@ -596,20 +596,20 @@
 
 
     def identify(self, x, y):
-        """Returns the name of the element at position x, y, or the 
+        """Returns the name of the element at position x, y, or the
         empty string if the coordinates are outside the window."""
         return self.tk.call(self._w, "identify", x, y)
 
 
     def validate(self):
-        """Force revalidation, independent of the conditions specified 
-        by the validate option. Returns 0 if validation fails, 1 if it 
+        """Force revalidation, independent of the conditions specified
+        by the validate option. Returns 0 if validation fails, 1 if it
         succeeds. Sets or clears the invalid state accordingly."""
         return self.tk.call(self._w, "validate")
 
 
 class Combobox(Entry):
-    """Ttk Combobox widget combines a text field with a pop-down list of 
+    """Ttk Combobox widget combines a text field with a pop-down list of
     values."""
 
     def __init__(self, master=None, cnf={}, **kw):
@@ -621,16 +621,16 @@
 
         WIDGET-SPECIFIC OPTIONS
 
-            exportselection, justify, height, postcommand, state, 
+            exportselection, justify, height, postcommand, state,
             textvariable, values, width
         """
         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, 
-        returns the index of the current value in the list of values 
+        """If newindex is supplied, sets the combobox value to the
+        element at position newindex in the list of values. Otherwise,
+        returns the index of the current value in the list of values
         or -1 if the current value does not appear in the list."""
         return self.tk.call(self._w, "current", newindex)
 
@@ -641,7 +641,7 @@
 
 
 class Frame(Widget):
-    """Ttk Frame widget is a container, used to group other widgets 
+    """Ttk Frame widget is a container, used to group other widgets
     together."""
 
     def __init__(self, master=None, cnf={}, **kw):
@@ -660,12 +660,12 @@
 
 class Label(Widget):
     """Ttk Label widget displays a textual label and/or image."""
-    
+
     def __init__(self, master=None, cnf={}, **kw):
         """Construct a Ttk Label with parent master.
 
         STANDARD OPTIONS
-            
+
             class, compound, cursor, image, style, takefocus, text,
             textvariable, underline, width
 
@@ -695,7 +695,7 @@
         """
         Widget.__init__(self, master, "ttk::labelframe", cnf, kw)
 
-LabelFrame = Labelframe # Tkinter name compatibility
+LabelFrame = Labelframe # tkinter name compatibility
 
 
 class Menubutton(Widget):
@@ -707,7 +707,7 @@
 
         STANDARD OPTIONS
 
-            class, compound, cursor, image, state, style, takefocus, 
+            class, compound, cursor, image, state, style, takefocus,
             text, textvariable, underline, width
 
         WIDGET-SPECIFIC OPTIONS
@@ -746,7 +746,7 @@
                 * The name of a child window
                 * A positional specification of the form "@x,y", which
                   defines the tab
-                * The string "current", which identifies the 
+                * The string "current", which identifies the
                   currently-selected tab
                 * The string "end", which returns the number of tabs (only
                   valid for method index)
@@ -778,7 +778,7 @@
 
 
     def identify(self, x, y):
-        """Returns the name of the tab element at position x, y, or the 
+        """Returns the name of the tab element at position x, y, or the
         empty string if none."""
         return self.tk.call(self._w, "identify", x, y)
 
@@ -793,7 +793,7 @@
         """Inserts a pane at the specified position.
 
         pos is either the string end, an integer index, or the name of
-        a managed child. If child is already managed by the notebook, 
+        a managed child. If child is already managed by the notebook,
         moves it to the specified position."""
         self.tk.call(self._w, "insert", pos, child, *(_format_optdict(kw)))
 
@@ -801,7 +801,7 @@
     def select(self, tab_id=None):
         """Selects the specified tab.
 
-        The associated child window will be displayed, and the 
+        The associated child window will be displayed, and the
         previously-selected window (if different) is unmapped. If tab_id
         is omitted, returns the widget name of the currently selected
         pane."""
@@ -828,8 +828,8 @@
 
         This will extend the bindings for the toplevel window containing
         this notebook as follows:
-            
-            Control-Tab: selects the tab following the currently selected 
+
+            Control-Tab: selects the tab following the currently selected
                          one
 
             Shift-Control-Tab: selects the tab preceding the currently
@@ -840,7 +840,7 @@
 
         Multiple notebooks in a single toplevel may be enabled for
         traversal, including nested notebooks. However, notebook traversal
-        only works properly if all panes are direct children of the 
+        only works properly if all panes are direct children of the
         notebook."""
         # The only, and good, difference I see is about mnemonics, which works
         # after calling this method. Control-Tab and Shift-Control-Tab always
@@ -848,7 +848,7 @@
         self.tk.call("ttk::notebook::enableTraversal", self)
 
 
-class Panedwindow(Widget, Tkinter.PanedWindow):
+class Panedwindow(Widget, tkinter.PanedWindow):
     """Ttk Panedwindow widget displays a number of subwindows, stacked
     either vertically or horizontally."""
 
@@ -864,13 +864,13 @@
             orient, width, height
 
         PANE OPTIONS
-            
+
             weight
         """
         Widget.__init__(self, master, "ttk::panedwindow", cnf, kw)
 
 
-    forget = Tkinter.PanedWindow.remove
+    forget = tkinter.PanedWindow.remove
 
 
     def insert(self, pos, child, **kw):
@@ -884,8 +884,8 @@
 
     def pane(self, pane, **kw):
         """Query or modify the options of the specified pane.
-        
-        pane is either an integer index or the name of a managed 
+
+        pane is either an integer index or the name of a managed
         subwindow. If no options are specified, returns a dict of the
         pane option values, if an option is specified without a value,
         returns the value of that option. Otherwise, the options are set."""
@@ -895,18 +895,18 @@
     def sashpos(self, index, newpos=None):
         """If newpos is specified, sets the position of sash number index.
 
-        May adjust the positions of adjacent sashes to ensure that 
+        May adjust the positions of adjacent sashes to ensure that
         positions are monotonically increasing. Sash positions are further
         constrained to be between 0 and the total size of the widget.
 
         Returns the new position of sash number index."""
         return self.tk.call(self._w, "sashpos", index, newpos)
 
-PanedWindow = Panedwindow # Tkinter name compatibility
+PanedWindow = Panedwindow # tkinter name compatibility
 
 
 class Progressbar(Widget):
-    """Ttk Progressbar widget shows the status of a long-running 
+    """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
@@ -916,7 +916,7 @@
         """Construct a Ttk Progressbar with parent master.
 
         STANDARD OPTIONS
-            
+
             class, cursor, style, takefocus
 
         WIDGET-SPECIFIC OPTIONS
@@ -975,7 +975,7 @@
         return self.tk.call(self._w, "invoke")
 
 
-class Scrollbar(Widget, Tkinter.Scrollbar):
+class Scrollbar(Widget, tkinter.Scrollbar):
     """Ttk Scrollbar controls the viewport of a scrollable widget."""
 
     def __init__(self, master=None, cnf={}, **kw):
@@ -1018,7 +1018,7 @@
         """Construct a Ttk Sizegrip with parent master.
 
         STANDARD OPTIONS
-            
+
             class, cursor, state, style, takefocus
         """
         Widget.__init__(self, master, "ttk::sizegrip", cnf, kw)
@@ -1036,7 +1036,7 @@
 
         STANDARD OPTIONS
 
-            class, cursor, style, takefocus, xscrollcommand, 
+            class, cursor, style, takefocus, xscrollcommand,
             yscrollcommand
 
         WIDGET-SPECIFIC OPTIONS
@@ -1055,11 +1055,11 @@
 
 
     def bbox(self, 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. 
-        
+        """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 
+        If the item is not visible (i.e., if it is a descendant of a
         closed item or is scrolled offscreen), returns an empty string."""
         return self.tk.call(self._w, "bbox", item, column)
 
@@ -1073,14 +1073,14 @@
         """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 
+        are detached from tree. No items in newchildren may be an
         ancestor of item."""
         self.tk.call(self._w, "children", item, newchildren)
 
 
     def column(self, column, **kw):
-        """Query or modify the options for the specified column. 
-        
+        """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
@@ -1098,13 +1098,13 @@
         """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 
+        be reinserted at another point in the tree, but will not be
         displayed. The root item may not be detached."""
         self.tk.call(self._w, "detach", items)
 
 
     def exists(self, item):
-        """Returns 1 if the specified item is present in the three, 
+        """Returns 1 if the specified item is present in the three,
         0 otherwise."""
         return self.tk.call(self._w, "exists", item)
 
@@ -1124,7 +1124,7 @@
             image: image_name
                 Specifies an image to display to the right of the column
                 heading
-            anchor: anchor  
+            anchor: anchor
                 Specifies how the heading text should be aligned. One of
                 the standard Tk anchor values
             command: script
@@ -1133,7 +1133,7 @@
 
         To configure the tree column heading, call this with column = "#0" """
         return self.tk.call(self._w, "heading", column, *(_format_optdict(kw)))
-    
+
 
     def identify(self, component, x, y):
         """Returns a description of the specified component under the
@@ -1164,22 +1164,22 @@
         """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 
+        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 
+        is specified, it is used as the item identifier, iid must not
         already exist in the tree. Otherwise, a new unique identifier
         is generated."""
         opts, values = _format_optdict(kw, ignore='values'), kw.get('values')
         # values may need special formatting if any value contain a space
         if values:
-            opts += ("-values", 
+            opts += ("-values",
                 ' '.join(('{%s}' if ' ' in v else '%s') % v for v in values))
         if iid:
-            res = self.tk.call(self._w, "insert", parent, index, "-id", iid, 
+            res = self.tk.call(self._w, "insert", parent, index, "-id", iid,
                                *opts)
         else:
             res = self.tk.call(self._w, "insert", parent, index, *opts)
@@ -1188,11 +1188,11 @@
 
 
     def item(self, item, **kw):
-        """Query or modify the options for the specified item. 
-        
+        """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 
+        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."""
         return _val_or_dict(kw, self.tk.call, self._w, "item", item)
 
@@ -1201,7 +1201,7 @@
         """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 
+        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."""
         self.tk.call(self._w, "move", item, parent, index)
@@ -1222,16 +1222,16 @@
 
 
     def prev(self, item):
-        """Returns the identifier of item's previous sibling, or '' if 
+        """Returns the identifier of item's previous sibling, or '' if
         item is the first child of its parent."""
         return self.tk.call(self._w, "prev", item)
 
 
     def see(self, item):
         """Ensure that item is visible.
-        
-        Sets all of item's ancestors open option to True, and scrolls 
-        the widget if necessary so that item is within the visible 
+
+        Sets all of item's ancestors open option to True, and scrolls
+        the widget if necessary so that item is within the visible
         portion of the tree."""
         self.tk.call(self._w, "see", item)
 
@@ -1286,13 +1286,13 @@
     def tag_configure(self, tagname, **kw):
         """Query or modify the options for the specified tagname.
 
-        If one or more option/value pairs are specified, sets the value 
+        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."""
-        return _val_or_dict(kw, self.tk.call, self._w, "tag", "configure", 
+        return _val_or_dict(kw, self.tk.call, self._w, "tag", "configure",
                             tagname)
 
 


More information about the Python-checkins mailing list