python自动换壁纸
import random import ctypes import time import os # path = "D:\\壁纸\\" # 存储图片的文件夹 path = r"D:/壁纸/" # 存储图片的文件夹 while True: file = os.listdir(path) # 打开存储图片文件夹中的图片目录 print(file) filepath = path + random.choice(file) # 随机选取某张图片,建立绝对地址 ctypes.windll.user32.SystemParametersInfoW(20, 0, filepath, 0) # 设置桌面壁纸 time.sleep(15)
人生苦短,慢慢潇洒。
nsyw.run