diff --git a/buildconfig/stubs/pygame/event.pyi b/buildconfig/stubs/pygame/event.pyi index 59fd6a52f5..174201fefd 100644 --- a/buildconfig/stubs/pygame/event.pyi +++ b/buildconfig/stubs/pygame/event.pyi @@ -6,8 +6,6 @@ from pygame import Window, constants as _c class Event(EventLike): type: int - __dict__: dict[str, Any] - dict: dict[str, Any] # type: ignore @overload def __init__( @@ -15,7 +13,7 @@ class Event(EventLike): ) -> None: ... @overload def __init__( - self, dict: Optional[dict[str, Any]] = None, **kwargs: Any + self, dict: Optional[Dict[str, Any]] = None, **kwargs: Any ) -> None: ... def __getattribute__(self, name: str) -> Any: ... diff --git a/src_py/event.py b/src_py/event.py index 5e1045d993..fb97f00c0e 100644 --- a/src_py/event.py +++ b/src_py/event.py @@ -177,6 +177,11 @@ def __setattr__(self, name: str, value: Any): def __delattr__(self, name: str) -> None: del self._dict[name] + def __dir__(self): + ret = super().__dir__() + ret = (*ret, *self._dict.keys()) + return ret + EventType = Event _register_event_class(Event)