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

Out of date code example for tkinter's createfilehandler #66351

Closed
vadmium opened this issue Aug 6, 2014 · 10 comments
Closed

Out of date code example for tkinter's createfilehandler #66351

vadmium opened this issue Aug 6, 2014 · 10 comments
Assignees
Labels
docs Documentation in the Doc dir topic-tkinter type-bug An unexpected behavior, bug, or error

Comments

@vadmium
Copy link
Member

vadmium commented Aug 6, 2014

BPO 22155
Nosy @terryjreedy, @vadmium, @serhiy-storchaka
Files
  • file-handlers.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/terryjreedy'
    closed_at = <Date 2015-05-17.18:59:52.188>
    created_at = <Date 2014-08-06.10:18:37.849>
    labels = ['type-bug', 'expert-tkinter', 'docs']
    title = "Out of date code example for tkinter's createfilehandler"
    updated_at = <Date 2015-05-18.00:07:17.019>
    user = 'https://github.com/vadmium'

    bugs.python.org fields:

    activity = <Date 2015-05-18.00:07:17.019>
    actor = 'martin.panter'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2015-05-17.18:59:52.188>
    closer = 'terry.reedy'
    components = ['Documentation', 'Tkinter']
    creation = <Date 2014-08-06.10:18:37.849>
    creator = 'martin.panter'
    dependencies = []
    files = ['39402']
    hgrepos = []
    issue_num = 22155
    keywords = ['patch']
    message_count = 10.0
    messages = ['224922', '225085', '225094', '243387', '243410', '243414', '243422', '243423', '243424', '243437']
    nosy_count = 5.0
    nosy_names = ['terry.reedy', 'docs@python', 'python-dev', 'martin.panter', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue22155'
    versions = ['Python 2.7', 'Python 3.4', 'Python 3.5']

    @vadmium
    Copy link
    Member Author

    vadmium commented Aug 6, 2014

    The only documentation on “createfilehandle” and friends that I can find looks like it needs updating:

    https://docs.python.org/release/3.4.0/faq/gui.html#can-i-have-tk-events-handled-while-waiting-for-i-o

    I have been using the equivalent of this instead, for both Python 2 and 3:

    import tkinter
    widget = tkinter.Tk()
    widget.tk.createfilehandler(file, tkinter.READABLE | tkinter.WRITABLE, callback)
    ...
    widget.tk.deletefilehandler(file)

    However I have no idea if this is a supported, proper way, if one even still exists. The old way was removed by bpo-3638.

    BTW, there is a link to release/3.4.1 documentation but that returned a 404 error for me, so I linked to the 3.4.0 doc instead.

    @vadmium vadmium added docs Documentation in the Doc dir topic-tkinter labels Aug 6, 2014
    @vadmium vadmium changed the title Out of date code example for tkinter's createfilehandle Out of date code example for tkinter's createfilehandler Aug 6, 2014
    @terryjreedy
    Copy link
    Member

    The latest x.y docs are available at docs.python.org/x.y, such as
    https://docs.python.org/3.4/faq/gui.html

    I was not aware of this undocumented method of the undocumented tkapp class. It is not available on Windows, and the FAQ should say so. From Modules/_tkinter.c:

    /* Tcl_CreateFileHandler() changed several times; these macros deal with the messiness. In Tcl 8.0 and later, it is not available on Windows (and on Unix, only because Jack added it back); when available on Windows, it only applies to sockets. */

    Current _tkinter only supports 8.4+. The messiness still appears in the asyncio design.

    'createfile' does not appear on the pydoc page for tkinter; directly using createfilehandle seems to be the only access.

    @vadmium
    Copy link
    Member Author

    vadmium commented Aug 9, 2014

    Just about the broken docs link: I was trying to find a permanent version of the docs to link to. The usual docs page links to “Old versions” <https://www.python.org/doc/versions/\>, but top link there, 3.4.1, does not seem to be available.

    @vadmium
    Copy link
    Member Author

    vadmium commented May 17, 2015

    Here is a patch which moves the documentation from the FAQ into a new section at the bottom of the main “tkinter” reference manual page, and updates it. I also mentioned lack of Windows support. Let me know what you think!

    @terryjreedy
    Copy link
    Member

    Assuming that the details are correct, which I cannot check on Windows :-(, this looks good to me. If the tkinter doc is expanded and reorganized, that section might move but I cannot see a better place for it now. Martin, have you used that code (with Tkinter/tkinter) on both 2.7 and 3.x? Serhiy, if you want me to apply this, after you check it, I will.

    @serhiy-storchaka
    Copy link
    Member

    I'm not sure that this is right place to document these functions (they are methods of undocumented class), but the patch looks correct to me.

    If you will commit the patch, Terry, note that tkinter should be replaced with Tkinter in 2.7.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented May 17, 2015

    New changeset e8dd65c7fb6b by Terry Jan Reedy in branch '2.7':
    Issue bpo-22155: Add File Handlers subsection with createfilehandler to Tkinter
    https://hg.python.org/cpython/rev/e8dd65c7fb6b

    New changeset 1efcb7b6ec8a by Terry Jan Reedy in branch '3.4':
    Issue bpo-22155: Add File Handlers subsection with createfilehandler to tkinter
    https://hg.python.org/cpython/rev/1efcb7b6ec8a

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented May 17, 2015

    New changeset 8bd9da5635fe by Terry Jan Reedy in branch '3.4':
    Issue bpo-22155: News entry.
    https://hg.python.org/cpython/rev/8bd9da5635fe

    New changeset 850cbd54cc73 by Terry Jan Reedy in branch 'default':
    Issue bpo-22155: News entry.
    https://hg.python.org/cpython/rev/850cbd54cc73

    @terryjreedy
    Copy link
    Member

    Martin, thanks for the nice patch.

    @terryjreedy terryjreedy added the type-bug An unexpected behavior, bug, or error label May 17, 2015
    @vadmium
    Copy link
    Member Author

    vadmium commented May 18, 2015

    For the record, I have used this code in 2.7 in the past (though I mainly use Python 3). The Python 2 version of the changes look fine to 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
    docs Documentation in the Doc dir topic-tkinter type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants