There are many questions and articles about how to change desktop wallpaper using python script. Which is as under:
file = "---path---"
SPI_SETDESKWALLPAPER = 20
ctypes.windll.user32.SystemParametersInfoW(SPI_SETDESKWALLPAPER, 0, file , 0)
However, this code doesn't change the wallpaper position. It only changes the wallpaper file. Say, the earlier wallpaper was positioned as "fill". Then the new wallpaper will also be set as "fill". And we have to manually change that position to fit/fill/span/tile/centered as per our requirement.
There's a documentation here which talks about changing the wallpaper position using a C++ function using DESKTOP_WALLPAPER_POSITION enumeration (shobjidl_core.h)
.
However, I am not able to use that in python.
Can someone help me and point me in the right direction?
Can we change the wallpaper fit position using python script? How do we pass that parameter to the above code?
You simply have to modify 2 registry values. And need to set the wallpaper so it takes effect.