⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fixtk.py

📁 minimal python variant for small footprint apps like embedded apps
💻 PY
字号:
"""Utility which tries to locate the Tcl/Tk 8.0 DLLs on Windows.This is a no-op on other platforms."""# Error messages we may spit outNO_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 PATHenvironment 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 FAQfor 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: %sIf you don't know how to fix this, consider searching the Python FAQfor the error you get; post to the comp.lang.python if all else fails.Read the source file FixTk.py for details."""import sysif 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))

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -