PyXR

c:\python24\lib\lib-tk \ FixTk.py



0001 import sys, os
0002 
0003 # Delay import _tkinter until we have set TCL_LIBRARY,
0004 # so that Tcl_FindExecutable has a chance to locate its
0005 # encoding directory.
0006 
0007 # Unfortunately, we cannot know the TCL_LIBRARY directory
0008 # if we don't know the tcl version, which we cannot find out
0009 # without import Tcl. Fortunately, Tcl will itself look in
0010 # <TCL_LIBRARY>\..\tcl<TCL_VERSION>, so anything close to
0011 # the real Tcl library will do.
0012 
0013 prefix = os.path.join(sys.prefix,"tcl")
0014 # if this does not exist, no further search is needed
0015 if os.path.exists(prefix):
0016     if not os.environ.has_key("TCL_LIBRARY"):
0017         for name in os.listdir(prefix):
0018             if name.startswith("tcl"):
0019                 tcldir = os.path.join(prefix,name)
0020                 if os.path.isdir(tcldir):
0021                     os.environ["TCL_LIBRARY"] = tcldir
0022     # Compute TK_LIBRARY, knowing that it has the same version
0023     # as Tcl
0024     import _tkinter
0025     ver = str(_tkinter.TCL_VERSION)
0026     if not os.environ.has_key("TK_LIBRARY"):
0027         v = os.path.join(prefix, 'tk'+ver)
0028         if os.path.exists(os.path.join(v, "tclIndex")):
0029             os.environ['TK_LIBRARY'] = v
0030     # We don't know the Tix version, so we must search the entire
0031     # directory
0032     if not os.environ.has_key("TIX_LIBRARY"):
0033         for name in os.listdir(prefix):
0034             if name.startswith("tix"):
0035                 tixdir = os.path.join(prefix,name)
0036                 if os.path.isdir(tixdir):
0037                     os.environ["TIX_LIBRARY"] = tixdir
0038 

Generated by PyXR 0.9.4
SourceForge.net Logo