@@ -48,18 +48,18 @@ def _get_image_from_kw(kw: dict[str, Any]) -> ImageFile.ImageFile | None:
4848
4949
5050def _pyimagingtkcall (
51- command : str , photo : PhotoImage | tkinter .PhotoImage , id : int
51+ command : str , photo : PhotoImage | tkinter .PhotoImage , ptr : object
5252) -> None :
5353 tk = photo .tk
5454 try :
55- tk .call (command , photo , id )
55+ tk .call (command , photo , ptr )
5656 except tkinter .TclError :
5757 # activate Tkinter hook
5858 # may raise an error if it cannot attach to Tkinter
5959 from . import _imagingtk
6060
6161 _imagingtk .tkinit (tk .interpaddr ())
62- tk .call (command , photo , id )
62+ tk .call (command , photo , repr ( ptr ) )
6363
6464
6565# --------------------------------------------------------------------
@@ -181,7 +181,7 @@ def paste(self, im: Image.Image) -> None:
181181 block = image .new_block (self .__mode , im .size )
182182 image .convert2 (block , image ) # convert directly between buffers
183183
184- _pyimagingtkcall ("PyImagingPhoto" , self .__photo , block .id )
184+ _pyimagingtkcall ("PyImagingPhoto" , self .__photo , block .ptr )
185185
186186
187187# --------------------------------------------------------------------
@@ -255,9 +255,8 @@ def __str__(self) -> str:
255255def getimage (photo : PhotoImage ) -> Image .Image :
256256 """Copies the contents of a PhotoImage to a PIL image memory."""
257257 im = Image .new ("RGBA" , (photo .width (), photo .height ()))
258- block = im .im
259258
260- _pyimagingtkcall ("PyImagingPhotoGet" , photo , block . id )
259+ _pyimagingtkcall ("PyImagingPhotoGet" , photo , im . im . ptr )
261260
262261 return im
263262
0 commit comments