Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 93 additions & 28 deletions stdlib/tkinter/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3146,9 +3146,6 @@ class Scrollbar(Widget):
def set(self, first: float | str, last: float | str) -> None: ...

_TextIndex: TypeAlias = _tkinter.Tcl_Obj | str | float | Misc
_WhatToCount: TypeAlias = Literal[
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"
]

class Text(Widget, XView, YView):
def __init__(
Expand Down Expand Up @@ -3268,15 +3265,23 @@ class Text(Widget, XView, YView):
def count(self, index1: _TextIndex, index2: _TextIndex, *, return_ints: Literal[True]) -> int: ...
@overload
def count(
self, index1: _TextIndex, index2: _TextIndex, arg: _WhatToCount | Literal["update"], /, *, return_ints: Literal[True]
self,
index1: _TextIndex,
index2: _TextIndex,
arg: Literal[
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
],
/,
*,
return_ints: Literal[True],
) -> int: ...
@overload
def count(
self,
index1: _TextIndex,
index2: _TextIndex,
arg1: Literal["update"],
arg2: _WhatToCount,
arg2: Literal["chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"],
/,
*,
return_ints: Literal[True],
Expand All @@ -3286,26 +3291,41 @@ class Text(Widget, XView, YView):
self,
index1: _TextIndex,
index2: _TextIndex,
arg1: _WhatToCount,
arg1: Literal["chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"],
arg2: Literal["update"],
/,
*,
return_ints: Literal[True],
) -> int: ...
@overload
def count(
self, index1: _TextIndex, index2: _TextIndex, arg1: _WhatToCount, arg2: _WhatToCount, /, *, return_ints: Literal[True]
self,
index1: _TextIndex,
index2: _TextIndex,
arg1: Literal["chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"],
arg2: Literal["chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"],
/,
*,
return_ints: Literal[True],
) -> tuple[int, int]: ...
@overload
def count(
self,
index1: _TextIndex,
index2: _TextIndex,
arg1: _WhatToCount | Literal["update"],
arg2: _WhatToCount | Literal["update"],
arg3: _WhatToCount | Literal["update"],
arg1: Literal[
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
],
arg2: Literal[
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
],
arg3: Literal[
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
],
/,
*args: _WhatToCount | Literal["update"],
*args: Literal[
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
],
return_ints: Literal[True],
) -> tuple[int, ...]: ...
@overload
Expand All @@ -3315,7 +3335,9 @@ class Text(Widget, XView, YView):
self,
index1: _TextIndex,
index2: _TextIndex,
arg: _WhatToCount | Literal["update"],
arg: Literal[
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
],
/,
*,
return_ints: Literal[False] = False,
Expand All @@ -3326,7 +3348,7 @@ class Text(Widget, XView, YView):
index1: _TextIndex,
index2: _TextIndex,
arg1: Literal["update"],
arg2: _WhatToCount,
arg2: Literal["chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"],
/,
*,
return_ints: Literal[False] = False,
Expand All @@ -3336,7 +3358,7 @@ class Text(Widget, XView, YView):
self,
index1: _TextIndex,
index2: _TextIndex,
arg1: _WhatToCount,
arg1: Literal["chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"],
arg2: Literal["update"],
/,
*,
Expand All @@ -3347,8 +3369,8 @@ class Text(Widget, XView, YView):
self,
index1: _TextIndex,
index2: _TextIndex,
arg1: _WhatToCount,
arg2: _WhatToCount,
arg1: Literal["chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"],
arg2: Literal["chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"],
/,
*,
return_ints: Literal[False] = False,
Expand All @@ -3358,36 +3380,79 @@ class Text(Widget, XView, YView):
self,
index1: _TextIndex,
index2: _TextIndex,
arg1: _WhatToCount | Literal["update"],
arg2: _WhatToCount | Literal["update"],
arg3: _WhatToCount | Literal["update"],
arg1: Literal[
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
],
arg2: Literal[
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
],
arg3: Literal[
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
],
/,
*args: _WhatToCount | Literal["update"],
*args: Literal[
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
],
return_ints: Literal[False] = False,
) -> tuple[int, ...]: ...
else:
@overload
def count(self, index1: _TextIndex, index2: _TextIndex) -> tuple[int] | None: ...
@overload
def count(
self, index1: _TextIndex, index2: _TextIndex, arg: _WhatToCount | Literal["update"], /
self,
index1: _TextIndex,
index2: _TextIndex,
arg: Literal[
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
],
/,
) -> tuple[int] | None: ...
@overload
def count(self, index1: _TextIndex, index2: _TextIndex, arg1: Literal["update"], arg2: _WhatToCount, /) -> int | None: ...
def count(
self,
index1: _TextIndex,
index2: _TextIndex,
arg1: Literal["update"],
arg2: Literal["chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"],
/,
) -> int | None: ...
@overload
def count(self, index1: _TextIndex, index2: _TextIndex, arg1: _WhatToCount, arg2: Literal["update"], /) -> int | None: ...
def count(
self,
index1: _TextIndex,
index2: _TextIndex,
arg1: Literal["chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"],
arg2: Literal["update"],
/,
) -> int | None: ...
@overload
def count(self, index1: _TextIndex, index2: _TextIndex, arg1: _WhatToCount, arg2: _WhatToCount, /) -> tuple[int, int]: ...
def count(
self,
index1: _TextIndex,
index2: _TextIndex,
arg1: Literal["chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"],
arg2: Literal["chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels"],
/,
) -> tuple[int, int]: ...
@overload
def count(
self,
index1: _TextIndex,
index2: _TextIndex,
arg1: _WhatToCount | Literal["update"],
arg2: _WhatToCount | Literal["update"],
arg3: _WhatToCount | Literal["update"],
arg1: Literal[
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
],
arg2: Literal[
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
],
arg3: Literal[
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
],
/,
*args: _WhatToCount | Literal["update"],
*args: Literal[
"chars", "displaychars", "displayindices", "displaylines", "indices", "lines", "xpixels", "ypixels", "update"
],
) -> tuple[int, ...]: ...

@overload
Expand Down
Loading