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

guilherme.polo python-checkins at python.org
Wed Jun 4 18:27:05 CEST 2008


Author: guilherme.polo
Date: Wed Jun  4 18:27:04 2008
New Revision: 63941

Log:
Added support for Ttk Scale widget, which wasn't documented in Tk's site.

Modified:
   sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst
   sandbox/trunk/ttk-gsoc/src/2.x/ttk.py
   sandbox/trunk/ttk-gsoc/src/3.x/ttk.py

Modified: sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst
==============================================================================
--- sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst	(original)
+++ sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst	Wed Jun  4 18:27:04 2008
@@ -41,10 +41,10 @@
    from Tkinter import *
    from ttk import *
 
-And then several :mod:`ttk` widgets (:class:`Button`, :class:`Entry`,
-:class:`Frame`, :class:`Label`, :class:`LabelFrame`, :class:`Menubutton`,
-:class:`PanedWindow`, :class:`Radiobutton` and :class:`Scrollbar`) will
-automatically substitute the Tk widgets.
+And then several :mod:`ttk` widgets (:class:`Button`, :class:`Checkbutton`,
+:class:`Entry`, :class:`Frame`, :class:`Label`, :class:`LabelFrame`,
+:class:`Menubutton`, :class:`PanedWindow`, :class:`Radiobutton`, :class:`Scale`
+and :class:`Scrollbar`) will automatically substitute the Tk widgets.
 
 This has the direct benefit of using the new widgets which gives better
 look & feel across platforms, but you should be aware that they are not
@@ -57,13 +57,13 @@
 Ttk Widgets
 -----------
 
-Ttk comes with 16 widgets, where 10 of these already existed in Tkinter:
+Ttk comes with 17 widgets, where 11 of these already existed in Tkinter:
 :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 subclass of
-:class:`Widget`.
+:class:`Radiobutton`, :class:`Scale` 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:`Widget`.
 
 Like it was told before, you will notice changes in look & feel as well in the
 styling code. To demonstrate the latter, a very simple example is shown below.

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	Wed Jun  4 18:27:04 2008
@@ -16,10 +16,10 @@
 
 __author__ = "Guilherme Polo <ggpolo at gmail.com>"
 
-__all__ = ["Button", "Checkbutton", "Combobox", "Entry", "Frame",
-           "Label", "Labelframe", "LabelFrame", "Menubutton", "Notebook",
-           "Panedwindow", "PanedWindow", "Progressbar", "Radiobutton",
-           "Scrollbar", "Separator", "Sizegrip", "Style", "Treeview",
+__all__ = ["Button", "Checkbutton", "Combobox", "Entry", "Frame", "Label",
+           "Labelframe", "LabelFrame", "Menubutton", "Notebook", "Panedwindow",
+           "PanedWindow", "Progressbar", "Radiobutton", "Scale", "Scrollbar",
+           "Separator", "Sizegrip", "Style", "Treeview",
            # Extensions
            "OptionMenu"]
 
@@ -991,6 +991,24 @@
         return self.tk.call(self._w, "invoke")
 
 
+class Scale(Widget, Tkinter.Scale):
+    """Ttk Scale widget is typically used to control the numeric value of
+    a linked variable that varies uniformly over some range."""
+
+    def __init__(self, master=None, **kw):
+        """Construct a Ttk Scale with parent master.
+
+        STANDARD OPTIONS
+
+            class, cursor, style, takefocus
+
+        WIDGET-SPECIFIC OPTIONS
+
+            command, from, length, orient, to, value, variable
+        """
+        Widget.__init__(self, master, "ttk::scale", kw)
+
+
 class Scrollbar(Widget, Tkinter.Scrollbar):
     """Ttk Scrollbar controls the viewport of a scrollable widget."""
 

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	Wed Jun  4 18:27:04 2008
@@ -16,10 +16,10 @@
 
 __author__ = "Guilherme Polo <ggpolo at gmail.com>"
 
-__all__ = ["Button", "Checkbutton", "Combobox", "Entry", "Frame",
-           "Label", "Labelframe", "LabelFrame", "Menubutton", "Notebook",
-           "Panedwindow", "PanedWindow", "Progressbar", "Radiobutton",
-           "Scrollbar", "Separator", "Sizegrip", "Style", "Treeview",
+__all__ = ["Button", "Checkbutton", "Combobox", "Entry", "Frame", "Label",
+           "Labelframe", "LabelFrame", "Menubutton", "Notebook", "Panedwindow",
+           "PanedWindow", "Progressbar", "Radiobutton", "Scale", "Scrollbar",
+           "Separator", "Sizegrip", "Style", "Treeview",
            # Extensions
            "OptionMenu"]
 
@@ -991,6 +991,24 @@
         return self.tk.call(self._w, "invoke")
 
 
+class Scale(Widget, tkinter.Scale):
+    """Ttk Scale widget is typically used to control the numeric value of
+    a linked variable that varies uniformly over some range."""
+
+    def __init__(self, master=None, **kw):
+        """Construct a Ttk Scale with parent master.
+
+        STANDARD OPTIONS
+
+            class, cursor, style, takefocus
+
+        WIDGET-SPECIFIC OPTIONS
+
+            command, from, length, orient, to, value, variable
+        """
+        Widget.__init__(self, master, "ttk::scale", kw)
+
+
 class Scrollbar(Widget, tkinter.Scrollbar):
     """Ttk Scrollbar controls the viewport of a scrollable widget."""
 


More information about the Python-checkins mailing list