]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #6160: The bbox() method of tkinter.Spinbox now returns a tuple of
authorSerhiy Storchaka <storchaka@gmail.com>
Sun, 3 Nov 2013 12:13:34 +0000 (14:13 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Sun, 3 Nov 2013 12:13:34 +0000 (14:13 +0200)
integers instead of a string.  Based on patch by Guilherme Polo.

Lib/tkinter/__init__.py
Lib/tkinter/test/test_tkinter/test_widgets.py
Misc/NEWS

index 2191ca7fc9f0a0a95b957acc50506727bbcedf92..549dfaabb83eda70760e3891eb935940b697dfd7 100644 (file)
@@ -3511,7 +3511,7 @@ class Spinbox(Widget, XView):
         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.
index 141bbf6f8b10a1f9cb6efdb70f80893cbc469081..7b89c74f97e9d512ff7bcfbf8841cbe25e307196 100644 (file)
@@ -457,6 +457,18 @@ class SpinboxTest(EntryTest, unittest.TestCase):
         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):
index ab1b98138a08214783ea0d05484d0cd98c2b9276..bc684d74ae63af0e2cea9034b41950542bebad01 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -13,6 +13,9 @@ Core and Builtins
 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.