mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-15 18:52:19 +03:00
Catch AttributeError for BitmapImage.__photo
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
This commit is contained in:
parent
11bcd5aaa9
commit
b9d1768561
|
@ -219,9 +219,10 @@ class BitmapImage:
|
||||||
self.__photo = tkinter.BitmapImage(data=image.tobitmap(), **kw)
|
self.__photo = tkinter.BitmapImage(data=image.tobitmap(), **kw)
|
||||||
|
|
||||||
def __del__(self) -> None:
|
def __del__(self) -> None:
|
||||||
if not hasattr(self, "__photo"):
|
try:
|
||||||
return
|
|
||||||
name = self.__photo.name
|
name = self.__photo.name
|
||||||
|
except AttributeError:
|
||||||
|
return
|
||||||
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