jeudi 29 juin 2017

Wallpaperchanger python

I've been trying to randomize my wallpaper change with python by combining code from different sources. I managed to make this code:

import ctypes
import os
import random
drive = "C:/Users/UserName/Desktop/FolderofWallpaperFolders"
afolder = os.listdir(drive)
folder = drive+ "/" + random.choice(afolder)
aimage = os.listdir(folder)
image = random.choice(aimage)
image_path = os.path.join(drive, folder, image)
SPI_SETDESKWALLPAPER = 20 
ctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0,image_path, 3)

but when I run it it turns my wallpaper to a completely black screen. Any modification suggestions?




Aucun commentaire:

Enregistrer un commentaire