From: Serhiy Storchaka Date: Sun, 3 Nov 2013 12:13:08 +0000 (+0200) Subject: Issue #6160: The bbox() method of Tkinter.Spinbox now returns a tuple of X-Git-Tag: v2.7.8~305 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8630f16eb7393649d501dd3f6982d15c799e24ee;p=python Issue #6160: The bbox() method of Tkinter.Spinbox now returns a tuple of integers instead of a string. Based on patch by Guilherme Polo. --- diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py index 529a3e4b16..6ad0cf1557 100644 --- a/Lib/lib-tk/Tkinter.py +++ b/Lib/lib-tk/Tkinter.py @@ -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. diff --git a/Lib/lib-tk/test/test_tkinter/test_widgets.py b/Lib/lib-tk/test/test_tkinter/test_widgets.py index 1380a73033..cfbc0b3718 100644 --- a/Lib/lib-tk/test/test_tkinter/test_widgets.py +++ b/Lib/lib-tk/test/test_tkinter/test_widgets.py @@ -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): diff --git a/Misc/NEWS b/Misc/NEWS index b5b355f2ff..59d06ea433 100644 --- 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.