mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
Depend on Pillow instead of types-Pillow (#11720)
This commit is contained in:
@@ -1,15 +1,20 @@
|
||||
# Verify that ImageTK images are valid to pass to TK code.
|
||||
from __future__ import annotations
|
||||
|
||||
import tkinter
|
||||
# The following tests don't work at the moment, due to pyright getting
|
||||
# confused by the existence of these stubs and annotations in the actual
|
||||
# Pillow package.
|
||||
# https://github.com/python/typeshed/issues/11688
|
||||
|
||||
from PIL import ImageTk
|
||||
# import tkinter
|
||||
|
||||
photo = ImageTk.PhotoImage()
|
||||
bitmap = ImageTk.BitmapImage()
|
||||
# from PIL import ImageTk
|
||||
|
||||
tkinter.Label(image=photo)
|
||||
tkinter.Label(image=bitmap)
|
||||
# photo = ImageTk.PhotoImage()
|
||||
# bitmap = ImageTk.BitmapImage()
|
||||
|
||||
tkinter.Label().configure(image=photo)
|
||||
tkinter.Label().configure(image=bitmap)
|
||||
# tkinter.Label(image=photo)
|
||||
# tkinter.Label(image=bitmap)
|
||||
|
||||
# tkinter.Label().configure(image=photo)
|
||||
# tkinter.Label().configure(image=bitmap)
|
||||
|
||||
@@ -3,14 +3,14 @@ import tkinter
|
||||
from _typeshed import ReadableBuffer, StrOrBytesPath, SupportsRead
|
||||
from typing import Any
|
||||
|
||||
from PIL.Image import Image, _Mode, _Size
|
||||
from PIL.Image import Image
|
||||
|
||||
class PhotoImage(tkinter._PhotoImageLike):
|
||||
tk: _tkinter.TkappType
|
||||
def __init__(
|
||||
self,
|
||||
image: Image | _Mode | None = None,
|
||||
size: _Size | None = None,
|
||||
image: Image | str | None = None,
|
||||
size: tuple[int, int] | None = None,
|
||||
*,
|
||||
file: StrOrBytesPath | SupportsRead[bytes] = ...,
|
||||
data: ReadableBuffer = ...,
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
from _typeshed import Incomplete
|
||||
|
||||
from PIL._imaging import _PixelAccessor
|
||||
from typing import Protocol
|
||||
|
||||
ffi: Incomplete
|
||||
|
||||
# Copy of PIL._imaging.PixelAccess.
|
||||
# See https://github.com/python/typeshed/issues/11688.
|
||||
class _PixelAccessor(Protocol):
|
||||
def __setitem__(self, xy: tuple[int, int], color, /) -> None: ...
|
||||
def __getitem__(self, xy: tuple[int, int], /): ...
|
||||
def putpixel(self, xy: tuple[int, int], color, /) -> None: ...
|
||||
def getpixel(self, xy: tuple[int, int], /): ...
|
||||
|
||||
class PyAccess(_PixelAccessor):
|
||||
readonly: Incomplete
|
||||
image8: Incomplete
|
||||
|
||||
Reference in New Issue
Block a user