11import _tkinter
22import sys
33from _typeshed import Incomplete , StrEnum , StrOrBytesPath
4- from collections .abc import Callable , Mapping , Sequence
4+ from collections .abc import Callable , Iterable , Mapping , Sequence
55from tkinter .constants import *
66from tkinter .font import _FontDescription
77from types import TracebackType
@@ -3331,9 +3331,33 @@ class PhotoImage(Image, _PhotoImageLike):
33313331 def blank (self ) -> None : ...
33323332 def cget (self , option : str ) -> str : ...
33333333 def __getitem__ (self , key : str ) -> str : ... # always string: image['height'] can be '0'
3334- def copy (self ) -> PhotoImage : ...
3335- def zoom (self , x : int , y : int | Literal ["" ] = "" ) -> PhotoImage : ...
3336- def subsample (self , x : int , y : int | Literal ["" ] = "" ) -> PhotoImage : ...
3334+ if sys .version_info >= (3 , 13 ):
3335+ def copy (
3336+ self ,
3337+ * ,
3338+ from_coords : Iterable [int ] | None = None ,
3339+ zoom : int | tuple [int , int ] | list [int ] | None = None ,
3340+ subsample : int | tuple [int , int ] | list [int ] | None = None ,
3341+ ) -> PhotoImage : ...
3342+ def subsample (self , x : int , y : Literal ["" ] = "" , * , from_coords : Iterable [int ] | None = None ) -> PhotoImage : ...
3343+ def zoom (self , x : int , y : Literal ["" ] = "" , * , from_coords : Iterable [int ] | None = None ) -> PhotoImage : ...
3344+ def copy_replace (
3345+ self ,
3346+ sourceImage : PhotoImage | str ,
3347+ * ,
3348+ from_coords : Iterable [int ] | None = None ,
3349+ to : Iterable [int ] | None = None ,
3350+ shrink : bool = False ,
3351+ zoom : int | tuple [int , int ] | list [int ] | None = None ,
3352+ subsample : int | tuple [int , int ] | list [int ] | None = None ,
3353+ # `None` defaults to overlay.
3354+ compositingrule : Literal ["overlay" , "set" ] | None = None ,
3355+ ) -> None : ...
3356+ else :
3357+ def copy (self ) -> PhotoImage : ...
3358+ def zoom (self , x : int , y : int | Literal ["" ] = "" ) -> PhotoImage : ...
3359+ def subsample (self , x : int , y : int | Literal ["" ] = "" ) -> PhotoImage : ...
3360+
33373361 def get (self , x : int , y : int ) -> tuple [int , int , int ]: ...
33383362 def put (
33393363 self ,
@@ -3348,7 +3372,44 @@ class PhotoImage(Image, _PhotoImageLike):
33483372 ),
33493373 to : tuple [int , int ] | None = None ,
33503374 ) -> None : ...
3351- def write (self , filename : StrOrBytesPath , format : str | None = None , from_coords : tuple [int , int ] | None = None ) -> None : ...
3375+ if sys .version_info >= (3 , 13 ):
3376+ def read (
3377+ self ,
3378+ filename : StrOrBytesPath ,
3379+ format : str | None = None ,
3380+ * ,
3381+ from_coords : Iterable [int ] | None = None ,
3382+ to : Iterable [int ] | None = None ,
3383+ shrink : bool = False ,
3384+ ) -> None : ...
3385+ def write (
3386+ self ,
3387+ filename : StrOrBytesPath ,
3388+ format : str | None = None ,
3389+ from_coords : Iterable [int ] | None = None ,
3390+ * ,
3391+ background : str | None = None ,
3392+ grayscale : bool = False ,
3393+ ) -> None : ...
3394+ @overload
3395+ def data (
3396+ self , format : str , * , from_coords : Iterable [int ] | None = None , background : str | None = None , grayscale : bool = False
3397+ ) -> bytes : ...
3398+ @overload
3399+ def data (
3400+ self ,
3401+ format : None = None ,
3402+ * ,
3403+ from_coords : Iterable [int ] | None = None ,
3404+ background : str | None = None ,
3405+ grayscale : bool = False ,
3406+ ) -> tuple [str , ...]: ...
3407+
3408+ else :
3409+ def write (
3410+ self , filename : StrOrBytesPath , format : str | None = None , from_coords : tuple [int , int ] | None = None
3411+ ) -> None : ...
3412+
33523413 def transparency_get (self , x : int , y : int ) -> bool : ...
33533414 def transparency_set (self , x : int , y : int , boolean : bool ) -> None : ...
33543415
0 commit comments