Skip to content

win32gui.SystemParametersInfo returns values but pyi says None #13426

@huntfx

Description

@huntfx

https://github.com/python/typeshed/blob/main/stubs/pywin32/win32/win32gui.pyi#L451

SystemParametersInfo will return different types based on the variable given to it, but the pyi file says it returns None. Maybe Any would work in this case? The alternative would be to hardcode each variable which would be quite excessive.

>>> win32gui.SystemParametersInfo(win32con.SPI_GETWHEELSCROLLLINES)
5
>>> win32gui.SystemParametersInfo(win32con.SPI_GETDESKWALLPAPER)
'c:\\wallpapers\\horizontal\\3357822.jpg'
>>> win32gui.SystemParametersInfo(win32con.SPI_GETWORKAREA)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NotImplementedError: Action 48 is not supported yet

These are all the types/exceptions of the SPI_GET* variables:

  • int
  • bool
  • str
  • tuple
  • dict
  • PyLOGFONT
  • NotImplementedError

And for SPI_SET*:

  • None
  • TypeError
  • NotImplementedError

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions