Skip to content

Commit 51be2ba

Browse files
committed
add types to most common tkinter.Entry methods (#5586)
* most common tkinter.Entry methods * type-ignore tkinter's lsp violation
1 parent f65cab3 commit 51be2ba

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

stdlib/tkinter/__init__.pyi

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,6 +1421,8 @@ class Checkbutton(Widget):
14211421
def select(self): ...
14221422
def toggle(self): ...
14231423

1424+
_EntryIndex = Union[str, int] # "INDICES" in manual page
1425+
14241426
class Entry(Widget, XView):
14251427
def __init__(
14261428
self,
@@ -1512,25 +1514,25 @@ class Entry(Widget, XView):
15121514
@overload
15131515
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
15141516
config = configure
1515-
def delete(self, first, last: Optional[Any] = ...): ...
1516-
def get(self): ...
1517-
def icursor(self, index): ...
1518-
def index(self, index): ...
1519-
def insert(self, index, string): ...
1517+
def delete(self, first: _EntryIndex, last: _EntryIndex | None = ...) -> None: ...
1518+
def get(self) -> str: ...
1519+
def icursor(self, index: _EntryIndex) -> None: ...
1520+
def index(self, index: _EntryIndex) -> int: ...
1521+
def insert(self, index: _EntryIndex, string: str) -> None: ...
15201522
def scan_mark(self, x): ...
15211523
def scan_dragto(self, x): ...
1522-
def selection_adjust(self, index): ...
1523-
select_adjust: Any
1524-
def selection_clear(self): ...
1525-
select_clear: Any
1526-
def selection_from(self, index): ...
1527-
select_from: Any
1528-
def selection_present(self): ...
1529-
select_present: Any
1530-
def selection_range(self, start, end): ...
1531-
select_range: Any
1532-
def selection_to(self, index): ...
1533-
select_to: Any
1524+
def selection_adjust(self, index: _EntryIndex) -> None: ...
1525+
def selection_clear(self) -> None: ... # type: ignore
1526+
def selection_from(self, index: _EntryIndex) -> None: ...
1527+
def selection_present(self) -> bool: ...
1528+
def selection_range(self, start: _EntryIndex, end: _EntryIndex) -> None: ...
1529+
def selection_to(self, index: _EntryIndex) -> None: ...
1530+
select_adjust = selection_adjust
1531+
select_clear = selection_clear
1532+
select_from = selection_from
1533+
select_present = selection_present
1534+
select_range = selection_range
1535+
select_to = selection_to
15341536

15351537
class Frame(Widget):
15361538
def __init__(

0 commit comments

Comments
 (0)