Skip to content

Commit 4b413fe

Browse files
authored
Merge pull request #3264 from aatle/display-stubs
Correct `pygame.display` stubs
2 parents 5d83e1a + 998738e commit 4b413fe

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

buildconfig/stubs/pygame/display.pyi

+5-3
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,16 @@ def set_mode(
4444
display: int = 0,
4545
vsync: int = 0,
4646
) -> Surface: ...
47-
def get_surface() -> Surface: ...
47+
def get_surface() -> Optional[Surface]: ...
4848
def flip() -> None: ...
4949
@overload
50+
def update() -> None: ...
51+
@overload
5052
def update(
51-
rectangle: Optional[Union[RectLike, Iterable[Optional[RectLike]]]] = None, /
53+
rectangle: Optional[Union[RectLike, Iterable[Optional[RectLike]]]], /
5254
) -> None: ...
5355
@overload
54-
def update(x: int, y: int, w: int, h: int, /) -> None: ...
56+
def update(x: float, y: float, w: float, h: float, /) -> None: ...
5557
@overload
5658
def update(xy: Point, wh: Point, /) -> None: ...
5759
def get_driver() -> str: ...

docs/reST/ref/display.rst

+5-1
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ required).
251251

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

274275
| :sl:`Update all, or a portion, of the display. For non-OpenGL displays.`
275-
| :sg:`update(rectangle=None, /) -> None`
276+
| :sg:`update() -> None`
277+
| :sg:`update(rectangle, /) -> None`
278+
| :sg:`update(x, y, w, h, /) -> None`
279+
| :sg:`update((x, y), (w, h), /) -> None`
276280
| :sg:`update(rectangle_iterable, /) -> None`
277281
278282
For non OpenGL display Surfaces, this function is very similar to

src_c/doc/display_doc.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
#define DOC_DISPLAY_QUIT "quit() -> None\nUninitialize the display module"
55
#define DOC_DISPLAY_GETINIT "get_init() -> bool\nReturns True if the display module has been initialized"
66
#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"
7-
#define DOC_DISPLAY_GETSURFACE "get_surface() -> Surface\nGet a reference to the currently set display surface"
7+
#define DOC_DISPLAY_GETSURFACE "get_surface() -> Surface\nget_surface() -> None\nGet a reference to the currently set display surface"
88
#define DOC_DISPLAY_FLIP "flip() -> None\nUpdate the full display Surface to the screen"
9-
#define DOC_DISPLAY_UPDATE "update(rectangle=None, /) -> None\nupdate(rectangle_iterable, /) -> None\nUpdate all, or a portion, of the display. For non-OpenGL displays."
9+
#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."
1010
#define DOC_DISPLAY_GETDRIVER "get_driver() -> name\nGet the name of the pygame display backend"
1111
#define DOC_DISPLAY_INFO "Info() -> VideoInfo\nCreate a video display information object"
1212
#define DOC_DISPLAY_GETWMINFO "get_wm_info() -> dict\nGet information about the current windowing system"

0 commit comments

Comments
 (0)