Skip to content

Commit

Permalink
Merge pull request #6006 from lukegb/tk-in-binary
Browse files Browse the repository at this point in the history
Support Python distributions where _tkinter is compiled in
  • Loading branch information
radarhere committed Mar 23, 2022
2 parents d0f1f66 + a13ba2e commit a4bb0ec
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/PIL/_tkinter_finder.py
Expand Up @@ -5,10 +5,15 @@
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":
Expand Down

0 comments on commit a4bb0ec

Please sign in to comment.