mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-27 10:26:19 +03:00
Look in a different location for the tk intepreter on pypy fixes #2376
This commit is contained in:
parent
e66271d464
commit
a69c37738a
|
@ -32,6 +32,13 @@ except ImportError:
|
||||||
tkinter = Tkinter
|
tkinter = Tkinter
|
||||||
del Tkinter
|
del Tkinter
|
||||||
|
|
||||||
|
# required for pypy, which always has cffi installed
|
||||||
|
try:
|
||||||
|
from cffi import FFI
|
||||||
|
ffi = FFI()
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
from . import Image
|
from . import Image
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
|
@ -184,7 +191,13 @@ class PhotoImage(object):
|
||||||
try:
|
try:
|
||||||
from . import _imagingtk
|
from . import _imagingtk
|
||||||
try:
|
try:
|
||||||
_imagingtk.tkinit(tk.interpaddr(), 1)
|
if hasattr(tk, 'interp'):
|
||||||
|
# Pypy is using a ffi cdata element
|
||||||
|
# (Pdb) self.tk.interp
|
||||||
|
# <cdata 'Tcl_Interp *' 0x3061b50>
|
||||||
|
_imagingtk.tkinit(int(ffi.cast("uintptr_t", tk.interp)), 1)
|
||||||
|
else:
|
||||||
|
_imagingtk.tkinit(tk.interpaddr(), 1)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
_imagingtk.tkinit(id(tk), 0)
|
_imagingtk.tkinit(id(tk), 0)
|
||||||
tk.call("PyImagingPhoto", self.__photo, block.id)
|
tk.call("PyImagingPhoto", self.__photo, block.id)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user