Skip to content

Commit 1a62ef9

Browse files
authored
Merge pull request #8782 from radarhere/imagetk
Removed ImageTk._show
2 parents 8e8b94a + ebc7a17 commit 1a62ef9

File tree

1 file changed

+1
-26
lines changed

1 file changed

+1
-26
lines changed

src/PIL/ImageTk.py

+1-26
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
import tkinter
3030
from io import BytesIO
31-
from typing import TYPE_CHECKING, Any, cast
31+
from typing import TYPE_CHECKING, Any
3232

3333
from . import Image, ImageFile
3434

@@ -263,28 +263,3 @@ def getimage(photo: PhotoImage) -> Image.Image:
263263
_pyimagingtkcall("PyImagingPhotoGet", photo, im.getim())
264264

265265
return im
266-
267-
268-
def _show(image: Image.Image, title: str | None) -> None:
269-
"""Helper for the Image.show method."""
270-
271-
class UI(tkinter.Label):
272-
def __init__(self, master: tkinter.Toplevel, im: Image.Image) -> None:
273-
self.image: BitmapImage | PhotoImage
274-
if im.mode == "1":
275-
self.image = BitmapImage(im, foreground="white", master=master)
276-
else:
277-
self.image = PhotoImage(im, master=master)
278-
if TYPE_CHECKING:
279-
image = cast(tkinter._Image, self.image)
280-
else:
281-
image = self.image
282-
super().__init__(master, image=image, bg="black", bd=0)
283-
284-
if not getattr(tkinter, "_default_root"):
285-
msg = "tkinter not initialized"
286-
raise OSError(msg)
287-
top = tkinter.Toplevel()
288-
if title:
289-
top.title(title)
290-
UI(top, image).pack()

0 commit comments

Comments
 (0)