Skip to content

Commit

Permalink
Fix for issue PythonCharmers#262 (non-existing tkinter imports in old…
Browse files Browse the repository at this point in the history
…er py27 versions)
  • Loading branch information
Miha Purg committed Sep 24, 2018
1 parent fdd5eeb commit 4e39735
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 6 deletions.
22 changes: 19 additions & 3 deletions src/future/moves/tkinter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,24 @@

if not PY3:
from Tkinter import *
from Tkinter import (_cnfmerge, _default_root, _flatten, _join, _setit,
_splitdict, _stringify, _support_default_root, _test,
_tkinter)
from Tkinter import (_cnfmerge, _default_root, _flatten,
_support_default_root, _test,
_tkinter, _setit)

try: # >= 2.7.4
from Tkinter import (_join)
except ImportError:
pass

try: # >= 2.7.4
from Tkinter import (_stringify)
except ImportError:
pass

try: # >= 2.7.9
from Tkinter import (_splitdict)
except ImportError:
pass

else:
from tkinter import *
22 changes: 19 additions & 3 deletions src/tkinter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,25 @@

if sys.version_info[0] < 3:
from Tkinter import *
from Tkinter import (_cnfmerge, _default_root, _flatten, _join, _setit,
_splitdict, _stringify, _support_default_root, _test,
_tkinter)
from Tkinter import (_cnfmerge, _default_root, _flatten,
_support_default_root, _test,
_tkinter, _setit)

try: # >= 2.7.4
from Tkinter import (_join)
except ImportError:
pass

try: # >= 2.7.4
from Tkinter import (_stringify)
except ImportError:
pass

try: # >= 2.7.9
from Tkinter import (_splitdict)
except ImportError:
pass

else:
raise ImportError('This package should not be accessible on Python 3. '
'Either you are trying to run from the python-future src folder '
Expand Down

0 comments on commit 4e39735

Please sign in to comment.