[Python-checkins] cpython (2.7): Issue #6160: The bbox() method of Tkinter.Spinbox now returns a tuple of

serhiy.storchaka python-checkins at python.org
Sun Nov 3 13:15:27 CET 2013


http://hg.python.org/cpython/rev/91453ba40b30
changeset:   86872:91453ba40b30
branch:      2.7
parent:      86854:4a2afda8f187
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Sun Nov 03 14:13:08 2013 +0200
summary:
  Issue #6160: The bbox() method of Tkinter.Spinbox now returns a tuple of
integers instead of a string.  Based on patch by Guilherme Polo.

files:
  Lib/lib-tk/Tkinter.py                        |   2 +-
  Lib/lib-tk/test/test_tkinter/test_widgets.py |  12 ++++++++++
  Misc/NEWS                                    |   3 ++
  3 files changed, 16 insertions(+), 1 deletions(-)


diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py
--- a/Lib/lib-tk/Tkinter.py
+++ b/Lib/lib-tk/Tkinter.py
@@ -3411,7 +3411,7 @@
         bounding box may refer to a region outside the
         visible area of the window.
         """
-        return self.tk.call(self._w, 'bbox', index)
+        return self._getints(self.tk.call(self._w, 'bbox', index)) or None
 
     def delete(self, first, last=None):
         """Delete one or more elements of the spinbox.
diff --git a/Lib/lib-tk/test/test_tkinter/test_widgets.py b/Lib/lib-tk/test/test_tkinter/test_widgets.py
--- a/Lib/lib-tk/test/test_tkinter/test_widgets.py
+++ b/Lib/lib-tk/test/test_tkinter/test_widgets.py
@@ -454,6 +454,18 @@
         widget = self.create()
         self.checkBooleanParam(widget, 'wrap')
 
+    def test_bbox(self):
+        widget = self.create()
+        bbox = widget.bbox(0)
+        self.assertEqual(len(bbox), 4)
+        for item in bbox:
+            self.assertIsInstance(item, int)
+
+        self.assertRaises(Tkinter.TclError, widget.bbox, 'noindex')
+        self.assertRaises(Tkinter.TclError, widget.bbox, None)
+        self.assertRaises(TypeError, widget.bbox)
+        self.assertRaises(TypeError, widget.bbox, 0, 1)
+
 
 @add_standard_options(StandardOptionsTests)
 class TextTest(AbstractWidgetTest, unittest.TestCase):
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@
 Library
 -------
 
+- Issue #6160: The bbox() method of tkinter.Spinbox now returns a tuple of
+  integers instead of a string.  Based on patch by Guilherme Polo.
+
 - Issue #19286: Directories in ``package_data`` are no longer added to
   the filelist, preventing failure outlined in the ticket.
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list