Skip to content

Commit cba73d9

Browse files
authored
Use a TypedDict for turtle._PenState (#13152)
1 parent 7a0f683 commit cba73d9

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

stdlib/turtle.pyi

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sys
22
from collections.abc import Callable, Sequence
33
from tkinter import Canvas, Frame, Misc, PhotoImage, Scrollbar
4-
from typing import Any, ClassVar, overload
4+
from typing import Any, ClassVar, Literal, TypedDict, overload
55
from typing_extensions import Self, TypeAlias
66

77
__all__ = [
@@ -141,8 +141,18 @@ if sys.version_info < (3, 13):
141141
_Color: TypeAlias = str | tuple[float, float, float]
142142
_AnyColor: TypeAlias = Any
143143

144-
# TODO: Replace this with a TypedDict once it becomes standardized.
145-
_PenState: TypeAlias = dict[str, Any]
144+
class _PenState(TypedDict):
145+
shown: bool
146+
pendown: bool
147+
pencolor: _Color
148+
fillcolor: _Color
149+
pensize: int
150+
speed: int
151+
resizemode: Literal["auto", "user", "noresize"]
152+
stretchfactor: tuple[float, float]
153+
shearfactor: float
154+
outline: int
155+
tilt: float
146156

147157
_Speed: TypeAlias = str | float
148158
_PolygonCoords: TypeAlias = Sequence[tuple[float, float]]

0 commit comments

Comments
 (0)