mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Fix hasattr for ImageTk.PhotoImage.__del__
This commit is contained in:
parent
87414b3f59
commit
11bcd5aaa9
|
@ -131,9 +131,10 @@ class PhotoImage:
|
||||||
self.paste(image)
|
self.paste(image)
|
||||||
|
|
||||||
def __del__(self) -> None:
|
def __del__(self) -> None:
|
||||||
if not hasattr(self, "__photo"):
|
try:
|
||||||
|
name = self.__photo.name
|
||||||
|
except AttributeError:
|
||||||
return
|
return
|
||||||
name = self.__photo.name
|
|
||||||
self.__photo.name = None
|
self.__photo.name = None
|
||||||
try:
|
try:
|
||||||
self.__photo.tk.call("image", "delete", name)
|
self.__photo.tk.call("image", "delete", name)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user