Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
4ca196dd
Commit
4ca196dd
authored
Feb 24, 2002
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set TCL_LIBRARY before import _tkinter. Suggested by Kirill Simonov.
Fixes #418173 and #219960. 2.2.1 candidate.
parent
a82d3470
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
10 deletions
+31
-10
Lib/lib-tk/FixTk.py
Lib/lib-tk/FixTk.py
+31
-10
No files found.
Lib/lib-tk/FixTk.py
View file @
4ca196dd
import
sys
,
os
,
_tkinter
import
sys
,
os
ver
=
str
(
_tkinter
.
TCL_VERSION
)
for
t
in
"tcl"
,
"tk"
,
"tix"
:
key
=
t
.
upper
()
+
"_LIBRARY"
try
:
v
=
os
.
environ
[
key
]
except
KeyError
:
v
=
os
.
path
.
join
(
sys
.
prefix
,
"tcl"
,
t
+
ver
)
if
os
.
path
.
exists
(
os
.
path
.
join
(
v
,
"tclIndex"
)):
os
.
environ
[
key
]
=
v
# Delay import _tkinter until we have set TCL_LIBRARY,
# so that Tcl_FindExecutable has a chance to locate its
# encoding directory.
# Unfortunately, we cannot know the TCL_LIBRARY directory
# if we don't know the tcl version, which we cannot find out
# without import Tcl. Fortunately, Tcl will itself look in
# <TCL_LIBRARY>\..\tcl<TCL_VERSION>, so anything close to
# the real Tcl library will do.
prefix
=
os
.
path
.
join
(
sys
.
prefix
,
"tcl"
)
# if this does not exist, no further search is needed
if
os
.
path
.
exists
(
prefix
):
if
not
os
.
environ
.
has_key
(
"TCL_LIBRARY"
):
for
name
in
os
.
listdir
(
prefix
):
if
name
.
startswith
(
"tcl"
):
tcldir
=
os
.
path
.
join
(
prefix
,
name
)
if
os
.
path
.
isdir
(
tcldir
):
os
.
environ
[
"TCL_LIBRARY"
]
=
tcldir
# Now set the other variables accordingly
import
_tkinter
ver
=
str
(
_tkinter
.
TCL_VERSION
)
for
t
in
"tk"
,
"tix"
:
key
=
t
.
upper
()
+
"_LIBRARY"
try
:
v
=
os
.
environ
[
key
]
except
KeyError
:
v
=
os
.
path
.
join
(
sys
.
prefix
,
"tcl"
,
t
+
ver
)
if
os
.
path
.
exists
(
os
.
path
.
join
(
v
,
"tclIndex"
)):
os
.
environ
[
key
]
=
v
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment