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

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

Closed
gpip opened this issue Sep 1, 2016 · 4 comments
Closed

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

gpip opened this issue Sep 1, 2016 · 4 comments

Comments

@gpip
Copy link

gpip commented Sep 1, 2016

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
@edschofield
Copy link
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
Copy link
Author

gpip commented Sep 22, 2016

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
Copy link
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
Copy link

alkrag commented Jul 20, 2023

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants