GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Tkinter, IDLE: Future Tcl and Tk can have differing version/patchlevel · Issue #104496 · python/cpython

Tkinter, IDLE: Future Tcl and Tk can have differing version/patchlevel #104496

New issue
Copy link
New issue
Copy link
Closed
Closed
Tkinter, IDLE: Future Tcl and Tk can have differing version/patchlevel#104496
Copy link
Labels
topic-tkintertype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@chrstphrchvz
chrstphrchvz
opened on May 15, 2023
Issue body actions

Tk 8.7 will be compatible with both Tcl 8.7 and Tcl 9.0; there is no Tk 9.0 currently in development. The version and/or patchlevel of Tcl and Tk will not necessarily be identical, but there are places in Tkinter code which assume they are. A few examples which I am aware of:

cpython/Lib/idlelib/help_about.py

Line 79 in 48b3617

tk_patchlevel = self.info_patchlevel()

cpython/Lib/test/test_tkinter/support.py

Line 103 in 48b3617

_tk_patchlevel = tcl.info_patchlevel()

cpython/Lib/test/test_tcl.py

Line 28 in 48b3617

_tk_patchlevel = tcl.info_patchlevel()

Linked PRs

  • gh-104496: IDLE - fix About for mixed tcl/tk versions #104585
  • [3.11] gh-104496: IDLE - fix About for mixed tcl/tk versions (GH-104585) #104587
  • gh-104496: Use correct Tcl or Tk version in Tkinter tests #107688
  • [3.12] gh-104496: Use correct Tcl or Tk version in Tkinter tests (GH-107688) #107709
  • [3.11] gh-104496: Use correct Tcl or Tk version in Tkinter tests (GH-107688) #107719

Activity

Next
  1. sunmy2019
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    topic-tkinter
    on May 15, 2023
  2. terryjreedy
    added
    topic-IDLE
    on May 15, 2023
  3. terryjreedy
    added this to IDLE Issueson May 15, 2023
  4. terryjreedy commented on May 15, 2023

    @terryjreedy
    terryjreedy
    on May 15, 2023
    Member
    More actions

    Is there different code to get tk version/patchlevel?

  5. chrstphrchvz commented on May 15, 2023

    @chrstphrchvz
    chrstphrchvz
    on May 15, 2023
    ContributorAuthor
    More actions

    Tcl version: tkinter.Tcl().tk.call('info', 'tclversion') and tkinter.Tcl().globalgetvar('tcl_version')
    Tcl patchlevel: tkinter.Tcl().tk.call('info', 'patchlevel') and tkinter.Tcl().globalgetvar('tcl_patchLevel')
    Tk version: tkinter.Tk().globalgetvar('tk_version')
    Tk patchlevel: tkinter.Tk().globalgetvar('tk_patchLevel')

    This issue is likely more applicable to version checks which need to be added (e.g. for issues like #104497) rather than existing ones (since checking for Tcl 8.6 is sufficient for knowing e.g. whether Tk has PNG support).

    For this issue, I am less inclined to propose a solution on my own without prior input. I hesitate to introduce more ways to retrieve the version/patchlevel. Personally, I try to rely on the Tcl package vcompare command rather than retrieve/expose the version/patchlevel and attempt to reimplement correct version comparison logic in Python or Perl.

  6. terryjreedy commented on May 17, 2023

    @terryjreedy
    terryjreedy
    on May 17, 2023
    Member
    More actions

    https://github.com/python/cpython/blob/48b3617de491f00a3bf978b355074cc8e228d61b/Lib/tkinter/__init__.py#LL1081C1-L1084C1 has the following, which includes all 'patchlevel' occurrences in the file.

        def info_patchlevel(self):  # Method of Misc, a base for toplevel and widgets. [comment added]
            """Returns the exact version of the Tcl library."""
            patchlevel = self.tk.call('info', 'patchlevel')
            return _parse_version(patchlevel)

    Is this call, the one that IDLE currently uses, returning the tcl or tk version?

  7. chrstphrchvz commented on May 17, 2023

    @chrstphrchvz
    chrstphrchvz
    on May 17, 2023
    ContributorAuthor
    More actions

    https://github.com/python/cpython/blob/48b3617de491f00a3bf978b355074cc8e228d61b/Lib/tkinter/__init__.py#LL1081C1-L1084C1 has the following, which includes all 'patchlevel' occurrences in the file.

        def info_patchlevel(self):  # Method of Misc, a base for toplevel and widgets. [comment added]
            """Returns the exact version of the Tcl library."""
            patchlevel = self.tk.call('info', 'patchlevel')
            return _parse_version(patchlevel)

    Is this call, the one that IDLE currently uses, returning the tcl or tk version?

    This always returns the Tcl patchlevel.

  8. terryjreedy
    added 2 commits that reference this issue on May 17, 2023

    pythongh-104496: IDLE - fix About for mixed tcl/tk versions

    1bb08fa

    gh-104496: IDLE - fix About for mixed tcl/tk versions (#104585)

    aed643b
  9. miss-islington
    added a commit that references this issue on May 17, 2023

    pythongh-104496: IDLE - fix About for mixed tcl/tk versions (pythonGH…

    182a463
  10. terryjreedy
    added a commit that references this issue on May 17, 2023

    [3.11] gh-104496: IDLE - fix About for mixed tcl/tk versions (GH-104585…

    0560fd3
  11. JelleZijlstra
    added a commit that references this issue on May 18, 2023

    pythongh-104496: IDLE - fix About for mixed tcl/tk versions (python#1…

    207d980
  12. terryjreedy commented on May 30, 2023

    @terryjreedy
    terryjreedy
    on May 30, 2023
    Member
    More actions

    I am not familiar with tcl in general, just enough to translate tk commands into tkinter. Are the 'package' commands available with the tcl we install with Windows and macOS?

  13. chrstphrchvz commented on May 31, 2023

    @chrstphrchvz
    chrstphrchvz
    on May 31, 2023
    ContributorAuthor
    More actions

    Are the 'package' commands available with the tcl we install with Windows and macOS?

    Yes.

  14. 7 remaining items

  15. miss-islington
    added a commit that references this issue on Aug 7, 2023

    pythongh-104496: Use correct Tcl or Tk version in Tkinter tests (pyth…

    185f71b
  16. serhiy-storchaka
    added 2 commits that reference this issue on Aug 7, 2023

    [3.11] pythongh-104496: Use correct Tcl or Tk version in Tkinter tests (

    d978b04

    [3.11] gh-104496: Use correct Tcl or Tk version in Tkinter tests (GH-…

    81c8f7d
  17. Yhg1s
    added a commit that references this issue on Aug 16, 2023

    [3.12] gh-104496: Use correct Tcl or Tk version in Tkinter tests (GH-…

    91d935b
  18. hugovk commented on Nov 10, 2023

    @hugovk
    hugovk
    on Nov 10, 2023
    Member
    More actions

    Anything left to do here, or can we close the issue?

  19. chrstphrchvz commented on Nov 10, 2023

    @chrstphrchvz
    chrstphrchvz
    on Nov 10, 2023
    ContributorAuthor
    More actions

    I think it is still too early to know what else needs to be done for this issue. I am not aware of any official announcement from Tcl/Tk on what their plan is now, but some of its inner developer circle still insists that Tk 9.0 be released and not Tk 8.7.

  20. chrstphrchvz commented on Nov 28, 2023

    @chrstphrchvz
    chrstphrchvz
    on Nov 28, 2023
    ContributorAuthor
    More actions

    The latest I have heard is that they want to release Tcl 9.0 and Tk 9.0 first, and then Tcl 8.7 and Tk 8.7 either later or not at all. I would still suggest version checks be careful about which of 8.6/8.7/9.0, Tcl or Tk, and “patchlevel” or “version” to check.

  21. dkfellows commented on Nov 28, 2023

    @dkfellows
    dkfellows
    on Nov 28, 2023
    More actions

    Tcl 9.0 will definitely ship before Tcl 8.7 (which is a "maybe, if there's demand great enough and developer effort enough"). Tk is a bit less certain, but there's a bit of head of steam getting up to go to 9.0 there too just so we can delete some really old and nasty undocumented cruft that I truly hope you're not depending on.

    We test Tcl 9.0 and Tk 8.7 as a combination, as well as Tcl 9.0 and Tk 9.0. We do not test Tcl 8.7 with Tk 9.0. Test result summaries are online.


    The proper, official methods for getting the version of Tk are:

    • set tk_version — returns 8.6, 8.7, 9.0 (i.e., just major.minor).
    • set tk_patchLevel — returns 8.6.12, 8.7a3, 9.0b1 (i.e., major.minor.patch with possible alpha/beta indicator)
    • package require Tk — returns 8.6.12, 8.7a3, 9.0b1 (same semantics as above, and loads the package if it wasn't already present)
    • In the shell script tkConfig.sh (which should be installed in any binary installation of Tk, possibly with an alternate name if there are Linux distributions about) there will be some variables like this:
      TK_VERSION='9.0'
      TK_MAJOR_VERSION='9'
      TK_MINOR_VERSION='0'
      TK_PATCH_LEVEL='b1'
      I think you can figure out what they mean. They're the only supported method (that I'm aware of) for getting the version without loading the Tk package in a Tcl interpreter. In particular, tkConfig.sh is intended for use during setting up a build process that depends on Tk.

    There are equivalents for Tcl, as well as info tclversion and info patchlevel. (I don't know why we never made tk patchlevel or tk version.)

  22. chrstphrchvz commented on Nov 29, 2023

    @chrstphrchvz
    chrstphrchvz
    on Nov 29, 2023
    ContributorAuthor
    More actions

    The proper, official methods for getting the version of Tk are:

    • set tk_version — returns 8.6, 8.7, 9.0 (i.e., just major.minor).
    • set tk_patchLevel — returns 8.6.12, 8.7a3, 9.0b1 (i.e., major.minor.patch with possible alpha/beta indicator)
    • package require Tk — returns 8.6.12, 8.7a3, 9.0b1 (same semantics as above, and loads the package if it wasn't already present)

    In Python syntax, the first two are still probably better done as e.g. tkinter.Tk().globalgetvar('tk_version') (which relies on Tcl_GetVar2Ex()) as in my above comment rather than trying to directly translate the Tcl syntax into tkinter.Tcl().tk.call('set', 'tk_version') or tkinter.Tcl().tk.eval('set tk_version').

    • In the shell script tkConfig.sh (which should be installed in any binary installation of Tk, possibly with an alternate name if there are Linux distributions about) there will be some variables like this:

      TK_VERSION='9.0'
      TK_MAJOR_VERSION='9'
      TK_MINOR_VERSION='0'
      TK_PATCH_LEVEL='b1'

      I think you can figure out what they mean. They're the only supported method (that I'm aware of) for getting the version without loading the Tk package in a Tcl interpreter. In particular, tkConfig.sh is intended for use during setting up a build process that depends on Tk.

    The only times I am aware that Tkinter needs to know Tcl/Tk versions without an interpreter are when configuring and compiling. But that is done using the macros from <tcl.h> and <tk.h>, after either providing the right Tcl/Tk compiler flags to the configure script or by using pkg-config (which is what many other FOSS projects use; Tcl/Tk provides much less via pkg-config than in tclConfig.sh/tkConfig.sh, but with https://core.tcl-lang.org/tcl/info/4b11db28e63d there now seems to be just enough for Tkinter to build).

  23. terryjreedy commented on Nov 29, 2023

    @terryjreedy
    terryjreedy
    on Nov 29, 2023
    Member
    More actions

    Has it been determined whether tcl/tk 9 will have full unicode support? Is there any approximate target date?

  24. terryjreedy commented on Sep 16, 2024

    @terryjreedy
    terryjreedy
    on Sep 16, 2024
    Member
    More actions

    In #124111 , Mark Culler, member of the Tcl Core Team (TCT), says "The TclTk project has decided that there will be no release of the 8.7 branches." and "8.6.15 and 9.0 versions of Tcl and Tk currently have release candidates, while Tcl and Tk 8.7 have never reached beta". Also, 9.0 will have full unicode support (no CESU-8).

  25. terryjreedy
    removed
    topic-IDLE
    on Jan 8, 2025
  26. terryjreedy commented on Jan 8, 2025

    @terryjreedy
    terryjreedy
    on Jan 8, 2025
    Member
    More actions

    If something else come up, we should open a new issue.

  27. terryjreedy
    closed this as completedon Jan 8, 2025
  28. github-project-automation
    moved this to Done in IDLE Issueson Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic-tkintertype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    • IDLE Issues
      Status
      Done
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.