Skip to content

tkinter._flatten and others not (easily) accessible #233

Closed
@gpip

Description

@gpip

Hello,

The tkinter package included here does a from Tkinter import *, which misses at least _flatten, and _cnfmerge which might be used by tk extensions. Therefore the typical method of handling Python 2/3 causes it to stop working when combined with python-future. Example:

try:
     import tkinter
except ImportError:
     import Tkinter as tkinter

after running the above on stock Python 2 or Python 3 tkinter._flatten is available, but not when using python-future. Packages that make use of that need to be patched with something like:

if not hasattr(tkinter, '_flatten'):
     from Tkinter import _flatten, _cnfmerge
     tkinter._flatten = _flatten
     tkinter._cnfmerge = _cnfmerge

Activity

edschofield

edschofield commented on Sep 21, 2016

@edschofield
Contributor

Thanks for the feedback, Guilherme!

I have added _flatten and _cnfmerge to the v0.16.x branch.

I would be very grateful if you could provide me with a comprehensive list of other underscore-prefixed names that deserve to be added. We could add these to the upcoming v0.16 release.

gpip

gpip commented on Sep 22, 2016

@gpip
Author

I believe the full list is ['_cnfmerge', '_default_root', '_exit', '_flatten', '_join', '_magic_re', '_setit', '_space_re', '_splitdict', '_stringify', '_support_default_root', '_test', '_tkerror', '_tkinter', '_varnum']. It's safer to add them all, but I would guess that _magic_re, _space_re, probably _exit and _tkerror, and _varnum are not/should not be in public use. The "semi-safe" list would then be:

['_cnfmerge', '_default_root', '_flatten', '_join', '_setit', '_splitdict', '_stringify', '_support_default_root', '_test', '_tkinter']

edschofield

edschofield commented on Oct 27, 2016

@edschofield
Contributor

I think this is fixed now in v0.16.0. Please feel free to re-open this issue if you encounter any more missing _names.

alkrag

alkrag commented on Jul 20, 2023

@alkrag

I had the problem - I tried the above - For me the issue was I had installed a newer version of Anaconda without deleting the earlier - It had always worked before - It worked on other computers - When I deleted the earlier versions, it worked again - Not sure if that's related...

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @edschofield@alkrag@gpip

        Issue actions

          tkinter._flatten and others not (easily) accessible · Issue #233 · PythonCharmers/python-future