mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-03-14 15:22:13 +03:00
Removed _show
This commit is contained in:
parent
5d52ede584
commit
ebc7a17d86
|
@ -28,7 +28,7 @@ from __future__ import annotations
|
||||||
|
|
||||||
import tkinter
|
import tkinter
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from typing import TYPE_CHECKING, Any, cast
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
from . import Image, ImageFile
|
from . import Image, ImageFile
|
||||||
|
|
||||||
|
@ -263,28 +263,3 @@ def getimage(photo: PhotoImage) -> Image.Image:
|
||||||
_pyimagingtkcall("PyImagingPhotoGet", photo, im.getim())
|
_pyimagingtkcall("PyImagingPhotoGet", photo, im.getim())
|
||||||
|
|
||||||
return im
|
return im
|
||||||
|
|
||||||
|
|
||||||
def _show(image: Image.Image, title: str | None) -> None:
|
|
||||||
"""Helper for the Image.show method."""
|
|
||||||
|
|
||||||
class UI(tkinter.Label):
|
|
||||||
def __init__(self, master: tkinter.Toplevel, im: Image.Image) -> None:
|
|
||||||
self.image: BitmapImage | PhotoImage
|
|
||||||
if im.mode == "1":
|
|
||||||
self.image = BitmapImage(im, foreground="white", master=master)
|
|
||||||
else:
|
|
||||||
self.image = PhotoImage(im, master=master)
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
image = cast(tkinter._Image, self.image)
|
|
||||||
else:
|
|
||||||
image = self.image
|
|
||||||
super().__init__(master, image=image, bg="black", bd=0)
|
|
||||||
|
|
||||||
if not getattr(tkinter, "_default_root"):
|
|
||||||
msg = "tkinter not initialized"
|
|
||||||
raise OSError(msg)
|
|
||||||
top = tkinter.Toplevel()
|
|
||||||
if title:
|
|
||||||
top.title(title)
|
|
||||||
UI(top, image).pack()
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user