This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Tkinter.Spinbox: fix bbox method
Type: behavior Stage: resolved
Components: Tkinter Versions: Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: BreamoreBoy, gpolo, python-dev, serhiy.storchaka, terry.reedy
Priority: normal Keywords: patch

Created on 2009-06-01 03:22 by gpolo, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
Spinbox_fixes.diff gpolo, 2009-06-01 03:22 review
Spinbox_fixes_2.patch serhiy.storchaka, 2013-11-02 19:51 review
Messages (9)
msg88634 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2009-06-01 03:22
The current bbox method for Tkinter.Spinbox is very likely to never
return a tuple. The attached patch uses _getints to always return a
tuple of integers.

The other changes in the patch are about removing unneeded return
statements.
msg112864 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-08-04 19:02
The patch is simple, can it be committed as is?
msg162420 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2012-06-06 19:25
I believe that for 3.x, Lib/lib-tk/Tkinter.py is not Lib/tkinter/__init__.py. I will put this on my list of issues to look at if possible.
msg180035 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-01-15 16:41
It should be "self._getints(...) or None" as in other methods.
msg201494 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-10-27 20:30
I withdraw my previous comment because the bbox command newer returns empty result. The patch LGTM.
msg201984 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-11-02 19:51
Patch updated to tip and added test.

Terry, do you think this patch should be applied to maintenance release? It change a behavior. However current behavior doesn't look desirable.
msg201988 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013-11-03 02:01
The bbox fix and the return change are unrelated issues. Let us separate them.

There are bbox methods for Grid, Canvax, Listbox, Text, and Spinbox. All are documented as returning tuples of (4) ints, though there are two different interpretations. The first 4 end with
  return self._getints(self.tk.call(...)) or None

Spinbox.bbox should be fixed in all versions to do the same. (The current patch leave off 'or None'. I am not sure if it is ever 'triggered', but let's be consistent.)  The new test looks good. I thought of checking that they are all non-negative, but that would really be a tk test and would not catch tk being off by 1, which I think is more likely than tk completely blundering by returning a negative int.

Grepping tkinter.__init__.py for 'an empty string' gives multiple hits that indicate to me (without detailed examination) that there are about 7 methods that return such. This is slightly odd in a Python context, but it is documented, hence not wrong. It does not seem to cause a problem; hence it should only be changed in the future after a deprecation period. (At least, I would not do so without pydev discussion, even though no sane code I can think of other than a complete test should depend on the return.) Moreover, no deprecation warning would be possible. So I would reject the idea unless someone wants to open a new issue and examine all such returns for possible change in Python 4.

Anyway, I removed '' returns from the title to make this issue just about Spinbox.bbox. With the patch (and news item) limited to bbox and its test and 'or None' added, I think this would be ready to push.
msg202016 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-11-03 12:15
New changeset 91453ba40b30 by Serhiy Storchaka in branch '2.7':
Issue #6160: The bbox() method of Tkinter.Spinbox now returns a tuple of
http://hg.python.org/cpython/rev/91453ba40b30

New changeset 5bdbf2258563 by Serhiy Storchaka in branch '3.3':
Issue #6160: The bbox() method of tkinter.Spinbox now returns a tuple of
http://hg.python.org/cpython/rev/5bdbf2258563

New changeset 75d8b9136fa6 by Serhiy Storchaka in branch 'default':
Issue #6160: The bbox() method of tkinter.Spinbox now returns a tuple of
http://hg.python.org/cpython/rev/75d8b9136fa6
msg202025 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-11-03 13:33
Thanks Terry.

> The new test looks good.

This is a copy of a test for ttk.Entry.

> Grepping tkinter.__init__.py for 'an empty string' gives multiple hits that indicate to me (without detailed examination) that there are about 7 methods that return such. This is slightly odd in a Python context, but it is documented, hence not wrong.

Actually there are methods which always return empty string without documenting it. I removed such changes from other Guilherme's patches.
History
Date User Action Args
2022-04-11 14:56:49adminsetgithub: 50410
2013-11-03 13:33:44serhiy.storchakasetstatus: open -> closed
resolution: fixed
messages: + msg202025

stage: patch review -> resolved
2013-11-03 12:15:26python-devsetnosy: + python-dev
messages: + msg202016
2013-11-03 02:01:33terry.reedysetmessages: + msg201988
title: Tkinter.Spinbox: fix for bbox and removed some uninteresting returns -> Tkinter.Spinbox: fix bbox method
2013-11-02 19:51:06serhiy.storchakasetfiles: + Spinbox_fixes_2.patch

messages: + msg201984
2013-10-31 16:08:01serhiy.storchakasetassignee: serhiy.storchaka
2013-10-27 20:30:34serhiy.storchakasetmessages: + msg201494
versions: + Python 3.3, Python 3.4, - Python 3.1, Python 3.2
2013-01-15 16:41:07serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg180035
2012-06-06 19:25:52terry.reedysetnosy: + terry.reedy
messages: + msg162420
2010-08-04 19:02:37BreamoreBoysetversions: + Python 3.2
nosy: + BreamoreBoy

messages: + msg112864

type: behavior
stage: patch review
2009-06-01 03:22:08gpolocreate