diff --git a/stdlib/turtle.pyi b/stdlib/turtle.pyi index e0a6b816c..cdacaf63c 100644 --- a/stdlib/turtle.pyi +++ b/stdlib/turtle.pyi @@ -142,9 +142,18 @@ _PenState: TypeAlias = dict[str, Any] _Speed: TypeAlias = str | float _PolygonCoords: TypeAlias = Sequence[tuple[float, float]] -# TODO: Type this more accurately -# Vec2D is actually a custom subclass of 'tuple'. -Vec2D: TypeAlias = tuple[float, float] +class Vec2D(tuple[float, float]): + def __new__(cls: type[Self], x: float, y: float) -> Self: ... + def __add__(self, other: tuple[float, float]) -> Vec2D: ... # type: ignore[override] + @overload # type: ignore[override] + def __mul__(self, other: Vec2D) -> float: ... + @overload + def __mul__(self, other: float) -> Vec2D: ... + def __rmul__(self, other: float) -> Vec2D: ... # type: ignore[override] + def __sub__(self, other: tuple[float, float]) -> Vec2D: ... + def __neg__(self) -> Vec2D: ... + def __abs__(self) -> float: ... + def rotate(self, angle: float) -> Vec2D: ... # Does not actually inherit from Canvas, but dynamically gets all methods of Canvas class ScrolledCanvas(Canvas, Frame): # type: ignore[misc]