]> granicus.if.org Git - python/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:08 +0000 (14:13 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Sun, 3 Nov 2013 12:13:08 +0000 (14:13 +0200)
integers instead of a string.  Based on patch by Guilherme Polo.

Lib/lib-tk/Tkinter.py
Lib/lib-tk/test/test_tkinter/test_widgets.py
Misc/NEWS

index 529a3e4b161ff2a59b2bba1e625dad1d0dfe0950..6ad0cf15570d0022a59cab8bd9514f7cabedfba9 100644 (file)
@@ -3411,7 +3411,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 1380a73033b25922ab17aa18363b4c2c59cbd629..cfbc0b371863936c0c790d12fce8684e028d80cb 100644 (file)
@@ -454,6 +454,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 b5b355f2ff40e9ee70a68276f57883ecd6c08aa1..59d06ea433620de993337f00c2ae31f94b62723a 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,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.