Skip to content

Commit

Permalink
Merge pull request #3264 from aatle/display-stubs
Browse files Browse the repository at this point in the history
Correct `pygame.display` stubs
  • Loading branch information
ankith26 authored Dec 19, 2024
2 parents 5d83e1a + 998738e commit 4b413fe
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
8 changes: 5 additions & 3 deletions buildconfig/stubs/pygame/display.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,16 @@ def set_mode(
display: int = 0,
vsync: int = 0,
) -> Surface: ...
def get_surface() -> Surface: ...
def get_surface() -> Optional[Surface]: ...
def flip() -> None: ...
@overload
def update() -> None: ...
@overload
def update(
rectangle: Optional[Union[RectLike, Iterable[Optional[RectLike]]]] = None, /
rectangle: Optional[Union[RectLike, Iterable[Optional[RectLike]]]], /
) -> None: ...
@overload
def update(x: int, y: int, w: int, h: int, /) -> None: ...
def update(x: float, y: float, w: float, h: float, /) -> None: ...
@overload
def update(xy: Point, wh: Point, /) -> None: ...
def get_driver() -> str: ...
Expand Down
6 changes: 5 additions & 1 deletion docs/reST/ref/display.rst
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ required).

| :sl:`Get a reference to the currently set display surface`
| :sg:`get_surface() -> Surface`
| :sg:`get_surface() -> None`
Return a reference to the currently set display Surface. If no display mode
has been set this will return None.
Expand All @@ -272,7 +273,10 @@ required).
.. function:: update

| :sl:`Update all, or a portion, of the display. For non-OpenGL displays.`
| :sg:`update(rectangle=None, /) -> None`
| :sg:`update() -> None`
| :sg:`update(rectangle, /) -> None`
| :sg:`update(x, y, w, h, /) -> None`
| :sg:`update((x, y), (w, h), /) -> None`
| :sg:`update(rectangle_iterable, /) -> None`
For non OpenGL display Surfaces, this function is very similar to
Expand Down
4 changes: 2 additions & 2 deletions src_c/doc/display_doc.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#define DOC_DISPLAY_QUIT "quit() -> None\nUninitialize the display module"
#define DOC_DISPLAY_GETINIT "get_init() -> bool\nReturns True if the display module has been initialized"
#define DOC_DISPLAY_SETMODE "set_mode(size=(0, 0), flags=0, depth=0, display=0, vsync=0) -> Surface\nInitialize a window or screen for display"
#define DOC_DISPLAY_GETSURFACE "get_surface() -> Surface\nGet a reference to the currently set display surface"
#define DOC_DISPLAY_GETSURFACE "get_surface() -> Surface\nget_surface() -> None\nGet a reference to the currently set display surface"
#define DOC_DISPLAY_FLIP "flip() -> None\nUpdate the full display Surface to the screen"
#define DOC_DISPLAY_UPDATE "update(rectangle=None, /) -> None\nupdate(rectangle_iterable, /) -> None\nUpdate all, or a portion, of the display. For non-OpenGL displays."
#define DOC_DISPLAY_UPDATE "update() -> None\nupdate(rectangle, /) -> None\nupdate(x, y, w, h, /) -> None\nupdate((x, y), (w, h), /) -> None\nupdate(rectangle_iterable, /) -> None\nUpdate all, or a portion, of the display. For non-OpenGL displays."
#define DOC_DISPLAY_GETDRIVER "get_driver() -> name\nGet the name of the pygame display backend"
#define DOC_DISPLAY_INFO "Info() -> VideoInfo\nCreate a video display information object"
#define DOC_DISPLAY_GETWMINFO "get_wm_info() -> dict\nGet information about the current windowing system"
Expand Down

0 comments on commit 4b413fe

Please sign in to comment.