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 images are valid. Any ideas?
import time;
import ctypes;
SPI_SETDESKWALLPAPER = 20
localtime = time.localtime(time.time())
wkd = localtime[6]
if wkd == 6:
ctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER,0,r"C:\Users\Owner\Documents\Wallpaper\1.jpg",0)
elif wkd == 0:
ctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER,0,r"C:\Users\Owner\Documents\Wallpaper\2.jpg",0)
elif wkd == 1:
ctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER,0,r"C:\Users\Owner\Documents\Wallpaper\3.jpg",0)
elif wkd == 2:
ctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER,0,r"C:\Users\Owner\Documents\Wallpaper\4.jpg",0)
elif wkd == 3:
ctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER,0,r"C:\Users\Owner\Documents\Wallpaper\5.jpg",0)
elif wkd == 4:
ctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER,0,r"C:\Users\Owner\Documents\Wallpaper\6.jpg",0)
elif wkd == 5:
ctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER,0,r"C:\Users\Owner\Documents\Wallpaper\7.jpg",0)
SystemParametersInfoactually return? - Dolda2000ctypes.windll.user32.SystemParametersInfoAevery couple of seconds and see if anything happens, or if it changes the background. - user764357fWinIni=SPIF_SENDCHANGE, which is 2. This broadcasts aWM_SETTINGCHANGEmessage. - Eryk Sun2instead of0. Read the docs. - Eryk SunSystemParametersInfoWto pass a wide string. - Eryk Sun