Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tix HList header_exists should be "exist" #69650

Closed
rtw mannequin opened this issue Oct 22, 2015 · 11 comments
Closed

Tix HList header_exists should be "exist" #69650

rtw mannequin opened this issue Oct 22, 2015 · 11 comments
Assignees
Labels
topic-tkinter type-bug An unexpected behavior, bug, or error

Comments

@rtw
Copy link
Mannequin

rtw mannequin commented Oct 22, 2015

BPO 25464
Nosy @terryjreedy, @serhiy-storchaka
Files
  • Lib-tkinter-tix-header_exist.patch: rename patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2016-10-25.07:32:19.547>
    created_at = <Date 2015-10-22.23:19:06.068>
    labels = ['type-bug', 'expert-tkinter']
    title = 'Tix HList header_exists should be "exist"'
    updated_at = <Date 2017-03-31.22:54:41.638>
    user = 'https://bugs.python.org/rtw'

    bugs.python.org fields:

    activity = <Date 2017-03-31.22:54:41.638>
    actor = 'terry.reedy'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2016-10-25.07:32:19.547>
    closer = 'serhiy.storchaka'
    components = ['Tkinter']
    creation = <Date 2015-10-22.23:19:06.068>
    creator = 'rtw'
    dependencies = []
    files = ['40842']
    hgrepos = []
    issue_num = 25464
    keywords = ['patch']
    message_count = 11.0
    messages = ['253357', '253358', '253859', '253882', '253883', '253891', '256722', '256723', '279339', '279369', '279373']
    nosy_count = 5.0
    nosy_names = ['terry.reedy', 'gpolo', 'python-dev', 'serhiy.storchaka', 'rtw']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue25464'
    versions = ['Python 2.7', 'Python 3.5', 'Python 3.6']

    @rtw
    Copy link
    Mannequin Author

    rtw mannequin commented Oct 22, 2015

    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.

    @rtw rtw mannequin added type-crash A hard crash of the interpreter, possibly with a core dump topic-tkinter labels Oct 22, 2015
    @terryjreedy
    Copy link
    Member

    (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'?

    @terryjreedy terryjreedy added type-bug An unexpected behavior, bug, or error and removed type-crash A hard crash of the interpreter, possibly with a core dump labels Oct 23, 2015
    @serhiy-storchaka
    Copy link
    Member

    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.

    @terryjreedy
    Copy link
    Member

    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.

    @serhiy-storchaka
    Copy link
    Member

    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.

    @terryjreedy
    Copy link
    Member

    If tkinter and IDLE are some places installed without tix, then it it not usable.

    What about the suggestion for a revised patch?

    @serhiy-storchaka serhiy-storchaka self-assigned this Nov 26, 2015
    @serhiy-storchaka
    Copy link
    Member

    Opened Tix bug: https://sourceforge.net/p/tix/bugs/110/ .

    @serhiy-storchaka
    Copy link
    Member

    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

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 24, 2016

    New changeset f57078cf5f13 by Serhiy Storchaka in branch '2.7':
    Issue bpo-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 bpo-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 bpo-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 bpo-25464: Fixed HList.header_exists() in tkinter.tix module by addin
    https://hg.python.org/cpython/rev/5b33829badcc

    @serhiy-storchaka
    Copy link
    Member

    It is hard to add tests because testing infrastructure for Tix doesn't exist.

    @terryjreedy
    Copy link
    Member

    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.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    topic-tkinter type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants