I\'m working on a simple (I thought) program to set a different desktop background for every day of the week. It runs with no errors but nothing happens. The path to the ima
If you are using Python 3 you should use ctypes.windll.user32.SystemParametersInfoW instead of ctypes.windll.user32.SystemParametersInfoA(W instead of A as this answer said).
Another answer described that because in Python 3 the str type is in form of UTF-16 as wchar_t * in C.
What's more, please minimize the code like this:
import time;
import ctypes;
SPI_SETDESKWALLPAPER = 20
wallpapers = r"C:\Users\Owner\Documents\Wallpaper\%d.jpg"
localtime = time.localtime(time.time())
wkd = localtime[6]
ctypes.windll.user32.SystemParametersInfoW(SPI_SETDESKWALLPAPER, 0, wallpapers%(wkd+1), 0)
Don't Repeat Yourself.