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: Tix HList header_exists should be "exist"
Type: behavior Stage: resolved
Components: Tkinter Versions: Python 3.6, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: gpolo, python-dev, rtw, serhiy.storchaka, terry.reedy
Priority: normal Keywords: patch

Created on 2015-10-22 23:19 by rtw, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
Lib-tkinter-tix-header_exist.patch rtw, 2015-10-22 23:19 rename patch review
Messages (11)
msg253357 - (view) Author: Rob Williscroft (rtw) * Date: 2015-10-22 23:19
The method header_exists of Tix HList raises:

File "...\python3\lib\tkinter\tix.py", line 926, in header_exists
    return self.tk.call(self._w, 'header', 'exists', col)
_tkinter.TclError: unknown option "exists". Must be cget, configure, create, delete, exist or size

IOW the option should be "exist" not "exists".

I've seen this on Windows with python 2.7 and 3.4 and Linux-Mint with 2.7.6.

The current method "header_exists" doesn't seem to be referenced or documented anywhere.
msg253358 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-10-23 01:09
(Rob: FYI, a crash is something worse than just an exception.)

I know very little about tix, so I don't know whether the bug is really passing 'exists' or that not being accepted.  I think it is the latter.  The offending function in class HList is

    def header_exists(self,  col):
        return self.tk.call(self._w, 'header', 'exists', col)

There are also

    def indicator_exists(self,  entry):
        return self.tk.call (self._w, 'indicator', 'exists', entry)
    def info_exists(self, entry):
        return self.tk.call(self._w, 'info', 'exists', entry)
    def item_exists(self, entry, col):
        return self.tk.call(self._w, 'item', 'exists', entry, col)

This pattern, and the more general pattern

    def x_y(arg1, ...):
        return self.tk.call(self._w, 'x', 'y', arg1, ...)

suggests that header_exists is written correctly and that 'exists' is not the error.  The other accepted options, cget, configure, create, delete, and size are other options for y when x is 'header'. 

I don't know what an 'entry' must be, but this runs without error.
>>> root = tix.Tk()
>>> hl = tix.HList(root)
>>> hl.info_exists('')
'0'

http://tix.sourceforge.net/dist/current/man/html/TixCmd/tixHList.htm#M73
also suggests that 'exists is correct, since the tcl for this is "pathName header exists col", with 'exists', not 'exist'.

Still, it is possible that the attached patch is the best we can do, but then, if I am correct, a comment should be added that it is a bug workaround.

A test is really needed, but test_tix, added in 3.5, is vestigial and only tests that tix.Tk() works on Windows. Adding real tests would be a separate issue.  Serhiy, is this something that might be done or is tix considered passe'?
msg253859 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-11-01 16:41
It looks as a bug in Tix. All other Tcl, Tk and Tix commands (except "assemblecode") use "exists", and "header exists" is documented. Perhaps we should workaround this bug. But I doubt about renaming header_exists to header_exist.

As for tests, I'm working on writing tests for Tix. The progress is slow because Tix provides a lot of classes with a lot of commands and options, but I hope to finish the work before releasing 3.6. We can commit the patch for this issue without tests, just add a reminder in test_tix.py.
msg253882 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-11-01 22:40
I agree. Leave the name 'header_exists', consistent with all others, pass 'exist', and add a comment.  Optional: report the bug upstream if there are tix maintainers somewhere.

Serhiy, my question about the status of tix is really whether I can use it in IDLE, since it is not now.
msg253883 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-11-01 23:00
> Serhiy, my question about the status of tix is really whether I can use it in IDLE, since it is not now.

I can't say anything. But be aware that Tix is optional and likely is not installed on Linux. Maintainers should add new dependence to IDLE package in every distribution.
msg253891 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-11-02 01:37
If tkinter and IDLE are some places installed without tix, then it it not usable.

What about the suggestion for a revised patch?
msg256722 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-12-19 09:19
Opened Tix bug: https://sourceforge.net/p/tix/bugs/110/ .
msg256723 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-12-19 09:34
As for using Tix in IDLE, on Python wiki [1] there is a mention about the 'Tixed' version of IDLE called IDEStudio: [2], [3].

[1] https://wiki.python.org/moin/Tix
[2] http://web.archive.org/web/20050307041957/starship.python.net/crew/mike/Idle/
[3] http://www.sourcefiles.org/Programming/Development/Environments/idestudio-1.9-linux-x86-350.tar.gz
msg279339 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-10-24 20:50
New changeset f57078cf5f13 by Serhiy Storchaka in branch '2.7':
Issue #25464: Fixed HList.header_exists() in Tix module by adding
https://hg.python.org/cpython/rev/f57078cf5f13

New changeset e928afbcc18a by Serhiy Storchaka in branch '3.5':
Issue #25464: Fixed HList.header_exists() in tkinter.tix module by addin
https://hg.python.org/cpython/rev/e928afbcc18a

New changeset 523aecdb8d5f by Serhiy Storchaka in branch '3.6':
Issue #25464: Fixed HList.header_exists() in tkinter.tix module by addin
https://hg.python.org/cpython/rev/523aecdb8d5f

New changeset 5b33829badcc by Serhiy Storchaka in branch 'default':
Issue #25464: Fixed HList.header_exists() in tkinter.tix module by addin
https://hg.python.org/cpython/rev/5b33829badcc
msg279369 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-10-25 07:32
It is hard to add tests because testing infrastructure for Tix doesn't exist.
msg279373 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-10-25 08:00
Subsequent to me suggesting a test, the 3.6 doc gained this: "Deprecated since version 3.6: This Tk extension is unmaintained and should not be used in new code."  This answers my question about using it in IDLE. Good to apply this anyway, but no test is fine with me.
History
Date User Action Args
2022-04-11 14:58:23adminsetgithub: 69650
2017-03-31 22:54:41terry.reedysetpull_requests: - pull_request833
2017-03-31 16:36:07dstufftsetpull_requests: + pull_request833
2016-10-25 08:00:40terry.reedysetmessages: + msg279373
2016-10-25 07:32:19serhiy.storchakasetstatus: open -> closed
resolution: fixed
messages: + msg279369

stage: needs patch -> resolved
2016-10-24 20:50:23python-devsetnosy: + python-dev
messages: + msg279339
2015-12-19 09:34:17serhiy.storchakasetmessages: + msg256723
versions: - Python 3.4
2015-12-19 09:19:50serhiy.storchakasetmessages: + msg256722
2015-11-26 23:23:45serhiy.storchakasetassignee: serhiy.storchaka
2015-11-02 01:37:16terry.reedysetmessages: + msg253891
2015-11-01 23:00:52serhiy.storchakasetmessages: + msg253883
2015-11-01 22:40:16terry.reedysetmessages: + msg253882
2015-11-01 16:41:07serhiy.storchakasetmessages: + msg253859
2015-10-23 01:09:44terry.reedysettype: crash -> behavior
stage: needs patch
messages: + msg253358
versions: + Python 3.5, Python 3.6
2015-10-22 23:38:13ethan.furmansetnosy: + terry.reedy, gpolo, serhiy.storchaka
2015-10-22 23:19:06rtwcreate