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
42405a5d
Commit
42405a5d
authored
Mar 31, 2000
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A version of FixTk.py that works with the way the installer now
installs Tcl/Tk.
parent
1b64a7e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
64 deletions
+4
-64
Lib/lib-tk/FixTk.py
Lib/lib-tk/FixTk.py
+4
-64
No files found.
Lib/lib-tk/FixTk.py
View file @
42405a5d
"""Utility which tries to locate the Tcl/Tk 8.0 DLLs on Windows.
import
sys
,
os
v
=
os
.
path
.
join
(
sys
.
prefix
,
"tcl"
,
"tcl8.3"
)
This is a no-op on other platforms.
if
os
.
path
.
exists
(
os
.
path
.
join
(
v
,
"init.tcl"
)):
"""
os
.
environ
[
"TCL_LIBRARY"
]
=
v
# Error messages we may spit out
NO_TCL_MESSAGE
=
"""
\
WHOOPS! I can't find a Tcl/Tk 8.0 installation anywhere.
Please make sure that Tcl.Tk 8.0 is installed and that the PATH
environment variable is set to include the Tcl/bin directory
(or wherever TK80.DLL and TCL80.DLL are installed).
If you don't know how to fix this, consider searching the Python FAQ
for the error you get; post to the comp.lang.python if all else fails.
Read the source file FixTk.py for details.
"""
NO_TKINTER_MESSAGE
=
"""
\
WHOOPS! Even though I think I have found a Tcl/Tk 8.0 installation,
I can't seem to import the _tkinter extension module.
I get the following exception:
ImportError: %s
If you don't know how to fix this, consider searching the Python FAQ
for the error you get; post to the comp.lang.python if all else fails.
Read the source file FixTk.py for details.
"""
import
sys
if
sys
.
platform
==
"win32"
:
try
:
import
_tkinter
except
ImportError
:
import
os
try
:
path
=
os
.
environ
[
'PATH'
]
except
KeyError
:
path
=
""
python_exe
=
sys
.
executable
python_dir
=
os
.
path
.
dirname
(
python_exe
)
program_files
=
os
.
path
.
dirname
(
python_dir
)
def
tclcheck
(
dir
):
for
dll
in
"tcl80.dll"
,
"tk80.dll"
,
"tclpip80.dll"
:
if
not
os
.
path
.
isfile
(
os
.
path
.
join
(
dir
,
dll
)):
return
0
return
1
for
tcldir
in
[
program_files
,
"
\
\
Program files"
,
"
\
\
"
,
"C:
\
\
Program Files"
,
"D:
\
\
Program Files"
]:
tcldir
=
os
.
path
.
join
(
tcldir
,
"Tcl"
,
"bin"
)
if
tclcheck
(
tcldir
):
break
else
:
tcldir
=
None
if
not
tcldir
:
sys
.
stderr
.
write
(
NO_TCL_MESSAGE
)
else
:
if
path
and
path
[
-
1
]
!=
os
.
pathsep
:
path
=
path
+
os
.
pathsep
path
=
path
+
tcldir
os
.
environ
[
"PATH"
]
=
path
os
.
putenv
(
"PATH"
,
path
)
try
:
import
_tkinter
except
ImportError
,
message
:
sys
.
stderr
.
write
(
NO_TKINTER_MESSAGE
%
str
(
message
))
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