[Python-checkins] r62623 - sandbox/trunk/ttk-gsoc/Lib/lib-tk/Ttk.py

guilherme.polo python-checkins at python.org
Fri May 2 03:07:09 CEST 2008


Author: guilherme.polo
Date: Fri May  2 03:07:09 2008
New Revision: 62623

Log:
Progressbar and Scrollbar wrapped

Modified:
   sandbox/trunk/ttk-gsoc/Lib/lib-tk/Ttk.py

Modified: sandbox/trunk/ttk-gsoc/Lib/lib-tk/Ttk.py
==============================================================================
--- sandbox/trunk/ttk-gsoc/Lib/lib-tk/Ttk.py	(original)
+++ sandbox/trunk/ttk-gsoc/Lib/lib-tk/Ttk.py	Fri May  2 03:07:09 2008
@@ -536,7 +536,46 @@
 PanedWindow = Panedwindow # Tkinter name compatibility
 
 
-class Progressbar(Widget): pass
+class Progressbar(Widget):
+    """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."""
+
+    def __init__(self, master=None, cnf={}, **kw):
+        """Construct a Ttk Progressbar with parent master.
+
+        STANDARD OPTIONS
+            
+            class, cursor, style, takefocus
+
+        WIDGET-SPECIFIC OPTIONS
+
+            orient, length, mode, maximum, value, variable, phase
+        """
+        Widget.__init__(self, master, "ttk::progressbar", cnf, kw)
+
+
+    def start(self, interval=None):
+        """Begin autoincrement mode: schedules a recurring timer event
+        that calls method step every interval milliseconds.
+
+        interval defaults to 50 milliseconds (20 steps/second) if ommited."""
+        self.tk.call(self._w, "start", interval)
+
+
+    def step(self, amount=None):
+        """Increments the value option by amount.
+
+        amount defaults to 1.0 if omitted."""
+        self.tk.call(self._w, "step", amount)
+
+
+    def stop(self):
+        """Stop autoincrement mode: cancels any recurring timer event
+        initiated by start."""
+        self.tk.call(self._w, "stop")
 
 
 class Radiobutton(Widget):
@@ -567,7 +606,21 @@
         return self.tk.call(self._w, "invoke")
 
 
-class Scrollbar(Widget): pass
+class Scrollbar(Widget, Tkinter.Scrollbar):
+    """Ttk Scrollbar controls the viewport of a scrollable widget."""
+
+    def __init__(self, master=None, cnf={}, **kw):
+        """Construct a Ttk Scrollbar with parent master.
+
+        STANDARD OPTIONS
+
+            class, cursor, style, takefocus
+
+        WIDGET-SPECIFIC OPTIONS
+
+            command, orient
+        """
+        Widget.__init__(self, master, "ttk::scrollbar", cnf, kw)
 
 
 class Separator(Widget):


More information about the Python-checkins mailing list