Merge pull request #6006 from lukegb/tk-in-binary

Support Python distributions where _tkinter is compiled in
This commit is contained in:
Andrew Murray 2022-03-23 12:40:27 +11:00 committed by GitHub
commit a4bb0ec660
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,10 +5,15 @@ import tkinter
import warnings
from tkinter import _tkinter as tk
if hasattr(sys, "pypy_find_executable"):
TKINTER_LIB = tk.tklib_cffi.__file__
else:
TKINTER_LIB = tk.__file__
try:
if hasattr(sys, "pypy_find_executable"):
TKINTER_LIB = tk.tklib_cffi.__file__
else:
TKINTER_LIB = tk.__file__
except AttributeError:
# _tkinter may be compiled directly into Python, in which case __file__ is
# not available. load_tkinter_funcs will check the binary first in any case.
TKINTER_LIB = None
tk_version = str(tkinter.TkVersion)
if tk_version == "8.4":