wallpaper changer.
Welcome to wallpaper changer
This is wallpaper changer using python.
You need to install this module.
You need to install this module.
ctypes
If you can use auto wallpaper change when you login
Then follow this step otherwise skip
1. convert .py file -to- .exe file then .exe file cut/copy
2. press win+R
3. write 'shell:startup' (this folder path paste .exe file) (this folder is auto run folder)
#
#copyright by pyproject lab
#
import ctypes
import os
import random
# You need to install ctypes
def set_wallpaper(image_path):
ctypes.windll.user32.SystemParametersInfoW(20, 0, image_path, 0x01 | 0x02)
def get_random_wallpaper(folder_path):
wallpapers = [os.path.join(folder_path, f) for f in os.listdir(folder_path) if
f.endswith(('.png', '.jpg', '.jpeg', '.bmp'))]
if not wallpapers:
raise ValueError("No wallpapers found in the specified folder.")
random_wallpaper = random.choice(wallpapers)
return random_wallpaper
# Path to your folder containing wallpapers
wallpaper_folder = "folder_path"
random_wallpaper = get_random_wallpaper(wallpaper_folder)
set_wallpaper(random_wallpaper)
Comments