@@ -3064,11 +3064,40 @@ class Text(Widget, XView, YView):
3064
3064
def edit_separator (self ) -> None : ... # actually returns empty string
3065
3065
def edit_undo (self ) -> None : ... # actually returns empty string
3066
3066
def get (self , index1 : _TextIndex , index2 : _TextIndex | None = None ) -> str : ...
3067
- # TODO: image_* methods
3068
- def image_cget (self , index , option ): ...
3069
- def image_configure (self , index , cnf : Incomplete | None = None , ** kw ): ...
3070
- def image_create (self , index , cnf = {}, ** kw ): ...
3071
- def image_names (self ): ...
3067
+ @overload
3068
+ def image_cget (self , index : _TextIndex , option : Literal ["image" , "name" ]) -> str : ...
3069
+ @overload
3070
+ def image_cget (self , index : _TextIndex , option : Literal ["padx" , "pady" ]) -> int : ...
3071
+ @overload
3072
+ def image_cget (self , index : _TextIndex , option : Literal ["align" ]) -> Literal ["baseline" , "bottom" , "center" , "top" ]: ...
3073
+ @overload
3074
+ def image_cget (self , index : _TextIndex , option : str ) -> Any : ...
3075
+ @overload
3076
+ def image_configure (self , index : _TextIndex , cnf : str ) -> tuple [str , str , str , str , str | int ]: ...
3077
+ @overload
3078
+ def image_configure (
3079
+ self ,
3080
+ index : _TextIndex ,
3081
+ cnf : dict [str , Any ] | None = {},
3082
+ * ,
3083
+ align : Literal ["baseline" , "bottom" , "center" , "top" ] = ...,
3084
+ image : _ImageSpec = ...,
3085
+ name : str = ...,
3086
+ padx : _ScreenUnits = ...,
3087
+ pady : _ScreenUnits = ...,
3088
+ ) -> dict [str , tuple [str , str , str , str , str | int ]] | None : ...
3089
+ def image_create (
3090
+ self ,
3091
+ index : _TextIndex ,
3092
+ cnf : dict [str , Any ] | None = {},
3093
+ * ,
3094
+ align : Literal ["baseline" , "bottom" , "center" , "top" ] = ...,
3095
+ image : _ImageSpec = ...,
3096
+ name : str = ...,
3097
+ padx : _ScreenUnits = ...,
3098
+ pady : _ScreenUnits = ...,
3099
+ ) -> str : ...
3100
+ def image_names (self ) -> tuple [str , ...]: ...
3072
3101
def index (self , index : _TextIndex ) -> str : ...
3073
3102
def insert (self , index : _TextIndex , chars : str , * args : str | list [str ] | tuple [str , ...]) -> None : ...
3074
3103
@overload
@@ -3166,12 +3195,45 @@ class Text(Widget, XView, YView):
3166
3195
def tag_ranges (self , tagName : str ) -> tuple [_tkinter .Tcl_Obj , ...]: ...
3167
3196
# tag_remove and tag_delete are different
3168
3197
def tag_remove (self , tagName : str , index1 : _TextIndex , index2 : _TextIndex | None = None ) -> None : ...
3169
- # TODO: window_* methods
3170
- def window_cget (self , index , option ): ...
3171
- def window_configure (self , index , cnf : Incomplete | None = None , ** kw ): ...
3198
+ @overload
3199
+ def window_cget (self , index : _TextIndex , option : Literal ["padx" , "pady" ]) -> int : ...
3200
+ @overload
3201
+ def window_cget (self , index : _TextIndex , option : Literal ["stretch" ]) -> bool : ... # actually returns Literal[0, 1]
3202
+ @overload
3203
+ def window_cget (self , index : _TextIndex , option : Literal ["align" ]) -> Literal ["baseline" , "bottom" , "center" , "top" ]: ...
3204
+ @overload # window is set to a widget, but read as the string name.
3205
+ def window_cget (self , index : _TextIndex , option : Literal ["create" , "window" ]) -> str : ...
3206
+ @overload
3207
+ def window_cget (self , index : _TextIndex , option : str ) -> Any : ...
3208
+ @overload
3209
+ def window_configure (self , index : _TextIndex , cnf : str ) -> tuple [str , str , str , str , str | int ]: ...
3210
+ @overload
3211
+ def window_configure (
3212
+ self ,
3213
+ index : _TextIndex ,
3214
+ cnf : dict [str , Any ] | None = None ,
3215
+ * ,
3216
+ align : Literal ["baseline" , "bottom" , "center" , "top" ] = ...,
3217
+ create : str = ...,
3218
+ padx : _ScreenUnits = ...,
3219
+ pady : _ScreenUnits = ...,
3220
+ stretch : bool | Literal [0 , 1 ] = ...,
3221
+ window : Misc | str = ...,
3222
+ ) -> dict [str , tuple [str , str , str , str , str | int ]] | None : ...
3172
3223
window_config = window_configure
3173
- def window_create (self , index , cnf = {}, ** kw ) -> None : ...
3174
- def window_names (self ): ...
3224
+ def window_create (
3225
+ self ,
3226
+ index : _TextIndex ,
3227
+ cnf : dict [str , Any ] | None = {},
3228
+ * ,
3229
+ align : Literal ["baseline" , "bottom" , "center" , "top" ] = ...,
3230
+ create : str = ...,
3231
+ padx : _ScreenUnits = ...,
3232
+ pady : _ScreenUnits = ...,
3233
+ stretch : bool | Literal [0 , 1 ] = ...,
3234
+ window : Misc | str = ...,
3235
+ ) -> None : ...
3236
+ def window_names (self ) -> tuple [str , ...]: ...
3175
3237
def yview_pickplace (self , * what ): ... # deprecated
3176
3238
3177
3239
class _setit :
0 commit comments