根据API更换Windows壁纸项目[python]
4195 字
21 分钟
根据API更换Windows壁纸项目[python]
根据API更换Windows壁纸项目[python]


前言
起因是这样的,我们学校上课用的一体机一直以来都是鸿合一体机自带的鸿合LOGO壁纸,十分无趣。 于是我写了这个程序用于远程间接性的控制电脑的壁纸,既没有人看到是我换的,也可也看到的自己喜欢的壁纸,岂不美哉。 说干就干,于是我花费2个小时写了这个。 技术不好,码烂勿喷。
说明:
测试平台
进阶版里内含了普通版,进阶版运行时会自动获取管理员权限,可能触发UAC弹窗警告。 程序支持多张壁纸按列表循环播放,内置记忆功能可读取上次播放的最后一张壁纸,并继续。 保存壁纸的目录为程序当前目录下的images(没有会自动创建) 程序采用注册表存储配置信息 web_url为API请求网址 注意:程序是通过对比 [本地已保存的API] 和 [在线的API] 来判断程序是否需要更新本地壁纸 更新壁纸时会清理掉已有的壁纸再进行下载
程序可通过pyinstaller/auto-py-to-exe打包成可执行文件.exe 再给exe程序搞个开机自启就可以了
{lamp/}
普通版(.py文件):
## ////////////////////////////////////////////////////////导包区////////////////////////////////////////////////////////import ctypesimport jsonimport osimport requestsimport scheduleimport shutilimport sysimport timeimport win32conimport win32guiimport winreg
## ////////////////////////////////////////////////////////配置区////////////////////////////////////////////////////////Version = '0.5'program_name = r'wallpaper'program_reg_path = r'SOFTWARE\\' + program_nameCreateKey = winreg.CreateKey(winreg.HKEY_CURRENT_USER, program_reg_path)OpenKey = winreg.OpenKey(winreg.HKEY_CURRENT_USER, program_reg_path)Program_path = os.path.dirname(os.path.realpath(sys.argv[0]))default_config = {'images_index': 0}
web_url = 'https://www.jacksen168.top/api/data?name=' + program_name + '&version=' + Versionprint(web_url)
## ////////////////////////////////////////////////////////模块区////////////////////////////////////////////////////////
# 联网判断抉择模块def isConnected(type, url): try: if type == 1: # url响应判断 requests.get(url, timeout=20) print('[\033[1;32;40m url响应正常 \033[0m]')
# url 请求状态判断 status = requests.get(url).status_code
if status == 200: print('[\033[1;32;40m 请求正常,状态码[%s] | url(%s) \033[0m]' % (status, url)) return True else: print('[\033[1;31;40m 请求异常,状态码[%s] | url(%s) \033[0m]' % (status, url)) return False else: # url响应判断 requests.get(url, timeout=20) print('[\033[1;32;40m url响应正常 \033[0m]') return True except: print('[\033[1;33;40m url响应异常 \033[0m]') return False
# 数据获取模块def get_json(type): if type == 0: # 优先选择在线数据,json if isConnected(1, web_url): # 有网络 return get_json(1) else: # 无网络 return get_json(2) elif type == 1: # 获取在线json try: url = requests.get(web_url) text = url.text if text == '': data = None else: data = json.loads(text) return data except: print('请求api发生未知错误') elif type == 2: # 获取离线json try: value, type = winreg.QueryValueEx(OpenKey, 'online_data') except: return None if value == '': data = None else: data = json.loads(value) return data
# 判断文件/路径是否存在 或 创建def if_path_exists(type, path): if type == 0: # 仅判断 if not os.path.exists(path): return False else: return True elif type == 1: # 判断并创建 if not os.path.exists(path): print('目录修复:', path, '[路径不存在]') # 在当前路径创建img/文件夹 os.makedirs(path) print('目录修复:', path, '[路径已创建]') return True else: return True else: return True
# 文件下载模块def downloadFile(filename, url): # 单文件下载--节省内存 # 屏蔽warning信息 requests.packages.urllib3.disable_warnings()
path = Program_path + '\\images' file = path + '\\' + filename
print('开始下载', '文件: ' + filename, '存储路径: ' + path, 'url: ' + url) if if_path_exists(1, path): # # 请求文件大小 # r1 = requests.get(url, stream=True, verify=False) # total_size = int(r1.headers['Content-Length'])
# 读取本地文件大小 if os.path.exists(file): temp_size = os.path.getsize(file) # 本地已经下载的文件大小 else: temp_size = 0
try: r = requests.get(url, stream=True, verify=False) with open(file, 'wb') as f: for chunk in r.iter_content(chunk_size=1024 * 10): # 每次只写10240byte = 10MB if chunk: temp_size += len(chunk) f.write(chunk) f.flush()
###这是下载实现进度显示#### # done = int(50 * temp_size / total_size) # # sys.stdout.write('\r[%s%s] %d%%' % ('█' * done, ' ' * (50 - done), 100 * temp_size / total_size)) # sys.stdout.flush() print(' ', '-' * 10, ' ' + filename + ' [\033[1;32;40m 下载完成 \033[0m]') except: print('下载出错') print('\n')
# 旧文件清理模块def old_file_cleanup(): dir = Program_path + '/images' if if_path_exists(0, dir): # 判断路径有效性,删除程序安装目录 print('开始删除', dir) shutil.rmtree(dir) print(dir, '文件夹删除成功') else: print(dir, '文件夹删除失败', '路径无效')
# 更换壁纸模块def wallpaper(): global images_index global global_data global Program_path
print(global_data['style'])
def set_wallpaper(img_path):
# 打开指定注册表路径 reg_key = winreg.CreateKey(winreg.HKEY_CURRENT_USER, "Control Panel\\Desktop") # 最后的参数:2拉伸,0居中/平铺,6适应,10填充,22跨区 winreg.SetValueEx(reg_key, 'WallpaperStyle', 0, winreg.REG_SZ, str(global_data['style']['WallpaperStyle'])) # 最后的参数:1表示平铺,拉伸居中等都是0(对上方设置的补充) winreg.SetValueEx(reg_key, "TileWallpaper", 0, win32con.REG_SZ, str(global_data['style']['TileWallpaper'])) # 通过注册表来修改壁纸(更贴进手动设置,比下面那个优先级要高。可避免背景设置成纯色重启电脑后,出现无法更换壁纸的情况) winreg.SetValueEx(reg_key, "WallPaper", 0, win32con.REG_SZ, img_path.replace('/', '\\')) # 刷新桌面与设置壁纸 win32gui.SystemParametersInfo(win32con.SPI_SETDESKWALLPAPER, img_path, win32con.SPIF_SENDWININICHANGE)
# 注意路径书写问题 # img_path = "E:/Pictures/通用/win10 Snow.jpg" if global_data['data'] is not None:
img_path = Program_path + "\\images\\" + global_data['data'][images_index]['name']
# 切换时要检查一下图片是否存在 if if_path_exists(0, img_path): set_wallpaper(img_path) else: print('壁纸更换失败:图片不存在', 'path:' + img_path)
# images_index更新 if images_index + 1 < len(global_data['data']): images_index = images_index + 1 set_config('images_index', images_index) else: images_index = 0 set_config('images_index', images_index) print('壁纸更换程序运行完毕,将index成功改为: ' + str(images_index) + '\n') else: print('壁纸更换失败:数据为空,等待同步')
# 数据同步模块def data_synchronization(): global global_data global images_index
# 同步数据及文件 if get_json(0) == get_json(2): # 数据无误 print('数据无误') else: # 数据存在差异:开始同步 # 壁纸index重置 images_index = 0
# 同步数据 print('数据存在差异:开始同步新数据') winreg.SetValueEx(CreateKey, 'online_data', 0, winreg.REG_SZ, json.dumps(global_data)) # winreg.CloseKey(CreateKey) print('本地数据同步完成')
# 同步文件 print('数据存在差异:开始同步新文件') old_file_cleanup() print('开始同步新文件') for index in range(len(global_data['data'])): # 根据data里的元素数量逐个下载文件 file_data = global_data['data'][index] if isConnected(2, file_data['url']): # 判断文件下载url是否有效 downloadFile(file_data['name'], file_data['url']) print('全部文件下载完毕')
# 首次运行配置数据修复模块def repair_config(): print('config配置信息开始修复') try: # 写入reg winreg.SetValueEx(CreateKey, 'config', 0, winreg.REG_SZ, json.dumps(default_config)) print('config配置信息修复完毕') except: print("Error:[配置数据修复模块]发生未知错误")
# 配置数据获取模块def get_config(config_item_name): try: key = winreg.OpenKey(win32con.HKEY_CURRENT_USER, program_reg_path, 0, win32con.KEY_ALL_ACCESS) config_data, type = winreg.QueryValueEx(key, "config") data = json.loads(config_data) return data[config_item_name] except FileNotFoundError: print('Warning:config为空') repair_config() return 0 except: print("Error:reg无法读取config")
# 配置数据修改模块def set_config(config_item_name, value): try: # 先读取config key = winreg.OpenKey(win32con.HKEY_CURRENT_USER, program_reg_path, 0, win32con.KEY_ALL_ACCESS) config_data, type = winreg.QueryValueEx(key, "config") data = json.loads(config_data) # 再修改config data[config_item_name] = value # 写入reg winreg.SetValueEx(CreateKey, 'config', 0, winreg.REG_SZ, json.dumps(data)) except FileNotFoundError: print('Error:set_config config读取失败') except: print("Error:[配置数据修改模块]发生未知错误")
## ////////////////////////////////////////////////////////run区////////////////////////////////////////////////////////
def start(): global global_data
if global_data is None: # 判断运行条件是否满足 # print('没有获取到数据,不满足运行条件,程序退出') print('初次运行,先等待5分钟(直到与服务器通信恢复)') time.sleep(5) start() else: # 有数据,运行条件满足(程序非第一次运行没有网络) print('网络已连接,开始同步数据') if global_data['status'] == 1: # 启动 print('程序启用状态') data_synchronization() else: print('程序关闭状态') exit() print('所有程序运行完毕,结束进程')
def run(): global global_data global images_index
global_data = get_json(0) print(global_data)
data = global_data images_index = get_config('images_index')
start() # 启动时第一次同步数据
# 启动线程 schedule.every(data['update_time']).seconds.do(data_synchronization) schedule.every(data['refresh_time']).seconds.do(wallpaper) print('当前更新速度' + str(data['update_time'])) print('当前刷新速度' + str(data['refresh_time'])) print('上次运行images_index:' + str(images_index)) print('程序初始化完毕', '/' * 300)
# 线程计时器 while True: schedule.run_pending() time.sleep(1)
## ////////////////////////////////////////////////////////启动区////////////////////////////////////////////////////////
run() # 启动程序API格式(json)
{ "time": 1664757166, "status": 1, "update_time": 3600, "refresh_time": 5, "style": { "WallpaperStyle": 10, "TileWallpaper": 0 }, "data": [ { "name": "jacksen168_Wallpaper_021_LOGO.jpg", "url": "https://jacksen168.top/img/last.jpg" } ]}含义
| 名称 | 含义 | 值 |
|---|---|---|
| time | 时间戳(可用于程序检查是否需要更新) | 默认时间戳 |
| status | 程序状态(程序的状态开关) | 0(关闭)/1(开启) |
| update_time | 检查更新时间(毫秒) | 时间(毫秒) |
| refresh_time | 壁纸刷新时间(毫秒) | 时间(毫秒) |
| style->WallpaperStyle | 更换壁纸样式(对应win10设置中的背景契合度) | 2拉伸,0居中/平铺,6适应,10填充,22跨区 |
| style->TileWallpaper | 更换壁纸样式(对应win10设置中的背景契合度) | 1表示平铺,拉伸居中等都是0(对上方设置的补充) |
| data->[]->name | 保存到本地图片的名称 | 图片.jpg/图片.png |
| data->[]->url | 需要下载的图片网址(url) | 例子: http://baidu.com/LOGO.jpg |
data是个数组,可选择多张壁纸循环播放,例子:
"data": [ { "name": "jacksen168_Wallpaper_021_1.jpg", "url": "https://jacksen168.top/img/last1.jpg" },{ "name": "jacksen168_Wallpaper_021_2.jpg", "url": "https://jacksen168.top/img/last2.jpg" },{ "name": "jacksen168_Wallpaper_021_3.jpg", "url": "https://jacksen168.top/img/last3.jpg" } ]{lamp/}
进阶版(程序自动获取管理员权限,可能会触发UAC弹窗警告):
说明:进阶版新增一种更换壁纸方式,会使win10设置里的背景无法修改(锁定)
## ////////////////////////////////////////////////////////导包区////////////////////////////////////////////////////////import ctypesimport jsonimport osimport shutilimport sysimport timeimport winreg
import requestsimport scheduleimport win32conimport win32gui
## ////////////////////////////////////////////////////////配置区////////////////////////////////////////////////////////Version = '0.5'program_name = r'wallpaper'program_reg_path = r'SOFTWARE\\' + program_nameCreateKey = winreg.CreateKey(winreg.HKEY_CURRENT_USER, program_reg_path)OpenKey = winreg.OpenKey(winreg.HKEY_CURRENT_USER, program_reg_path)Program_path = os.path.dirname(os.path.realpath(sys.argv[0]))default_config = {'images_index': 0}
web_url = 'https://www.jacksen168.top/api/data?name=' + program_name + '&version=' + Versionprint(web_url)
## ////////////////////////////////////////////////////////模块区////////////////////////////////////////////////////////
# 联网判断抉择模块def isConnected(type, url): try: if type == 1: # url响应判断 requests.get(url, timeout=20) print('[\033[1;32;40m url响应正常 \033[0m]')
# url 请求状态判断 status = requests.get(url).status_code
if status == 200: print('[\033[1;32;40m 请求正常,状态码[%s] | url(%s) \033[0m]' % (status, url)) return True else: print('[\033[1;31;40m 请求异常,状态码[%s] | url(%s) \033[0m]' % (status, url)) return False else: # url响应判断 requests.get(url, timeout=20) print('[\033[1;32;40m url响应正常 \033[0m]') return True except: print('[\033[1;33;40m url响应异常 \033[0m]') return False
# 数据获取模块def get_json(type): if type == 0: # 优先选择在线数据,json if isConnected(1, web_url): # 有网络 return get_json(1) else: # 无网络 return get_json(2) elif type == 1: # 获取在线json try: url = requests.get(web_url) text = url.text if text == '': data = None else: data = json.loads(text) return data except: print('请求api发生未知错误') elif type == 2: # 获取离线json try: value, type = winreg.QueryValueEx(OpenKey, 'online_data') except: return None if value == '': data = None else: data = json.loads(value) return data
# 判断文件/路径是否存在 或 创建def if_path_exists(type, path): if type == 0: # 仅判断 if not os.path.exists(path): return False else: return True elif type == 1: # 判断并创建 if not os.path.exists(path): print('目录修复:', path, '[路径不存在]') # 在当前路径创建img/文件夹 os.makedirs(path) print('目录修复:', path, '[路径已创建]') return True else: return True else: return True
# 文件下载模块def downloadFile(filename, url): # 单文件下载--节省内存 # 屏蔽warning信息 requests.packages.urllib3.disable_warnings()
path = Program_path + '\\images' file = path + '\\' + filename
print('开始下载', '文件: ' + filename, '存储路径: ' + path, 'url: ' + url) if if_path_exists(1, path): # # 请求文件大小 # r1 = requests.get(url, stream=True, verify=False) # total_size = int(r1.headers['Content-Length'])
# 读取本地文件大小 if os.path.exists(file): temp_size = os.path.getsize(file) # 本地已经下载的文件大小 else: temp_size = 0
try: r = requests.get(url, stream=True, verify=False) with open(file, 'wb') as f: for chunk in r.iter_content(chunk_size=1024 * 10): # 每次只写10240byte = 10MB if chunk: temp_size += len(chunk) f.write(chunk) f.flush()
###这是下载实现进度显示#### # done = int(50 * temp_size / total_size) # # sys.stdout.write('\r[%s%s] %d%%' % ('█' * done, ' ' * (50 - done), 100 * temp_size / total_size)) # sys.stdout.flush() print(' ', '-' * 10, ' ' + filename + ' [\033[1;32;40m 下载完成 \033[0m]') except: print('下载出错') print('\n')
# 旧文件清理模块def old_file_cleanup(): dir = Program_path + '/images' if if_path_exists(0, dir): # 判断路径有效性,删除程序安装目录 print('开始删除', dir) shutil.rmtree(dir) print(dir, '文件夹删除成功') else: print(dir, '文件夹删除失败', '路径无效')
# 更换壁纸模块def wallpaper(): global images_index global global_data global Program_path
print(global_data['style'])
def set_wallpaper(type, img_path): if type == 1: # 默认模式:模拟控制面板 print('模拟控制面板模式') # 清理type == 2的残留 try: reg_key_System = winreg.CreateKey(winreg.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System") winreg.DeleteValue(reg_key_System, 'WallpaperStyle') winreg.DeleteValue(reg_key_System, 'WallPaper') except: if False: print() # 打开指定注册表路径 reg_key = winreg.CreateKey(winreg.HKEY_CURRENT_USER, "Control Panel\\Desktop") # 最后的参数:2拉伸,0居中/平铺,6适应,10填充,22跨区 winreg.SetValueEx(reg_key, 'WallpaperStyle', 0, winreg.REG_SZ, str(global_data['style']['WallpaperStyle'])) # 最后的参数:1表示平铺,拉伸居中等都是0(对上方设置的补充) winreg.SetValueEx(reg_key, "TileWallpaper", 0, win32con.REG_SZ, str(global_data['style']['TileWallpaper'])) # 通过注册表来修改壁纸(更贴进手动设置,比下面那个优先级要高。可避免背景设置成纯色重启电脑后,出现无法更换壁纸的情况) winreg.SetValueEx(reg_key, "WallPaper", 0, win32con.REG_SZ, img_path.replace('/', '\\')) # 刷新桌面与设置壁纸 win32gui.SystemParametersInfo(win32con.SPI_SETDESKWALLPAPER, img_path, win32con.SPIF_SENDWININICHANGE) elif type == 2: print('管理员权限模式') # 打开指定注册表路径 reg_key = winreg.CreateKey(winreg.HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System") # 最后的参数:0=居中 ,1=平铺 ,2=拉伸 winreg.SetValueEx(reg_key, "WallpaperStyle", 0, win32con.REG_SZ, str(global_data['style']['WallpaperStyle'])) # 设置壁纸 winreg.SetValueEx(reg_key, "WallPaper", 0, win32con.REG_SZ, img_path.replace('/', '\\')) # 刷新桌面与设置壁纸 win32gui.SystemParametersInfo(win32con.SPI_SETDESKWALLPAPER, img_path, win32con.SPIF_SENDWININICHANGE)
print('[' + str(images_index) + "]成功切换壁纸:" + img_path)
# 注意路径书写问题 # img_path = "E:/Pictures/通用/win10 Snow.jpg" if global_data['data'] is not None:
img_path = Program_path + "\\images\\" + global_data['data'][images_index]['name']
# 切换时要检查一下图片是否存在 if if_path_exists(0, img_path): set_wallpaper(global_data['type'], img_path) else: print('壁纸更换失败:图片不存在', 'path:' + img_path)
# images_index更新 if images_index + 1 < len(global_data['data']): images_index = images_index + 1 set_config('images_index', images_index) else: images_index = 0 set_config('images_index', images_index) print('壁纸更换程序运行完毕,将index成功改为: ' + str(images_index) + '\n') else: print('壁纸更换失败:数据为空,等待同步')
# 数据同步模块def data_synchronization(): global global_data global images_index
# 同步数据及文件 if get_json(0) == get_json(2): # 数据无误 print('数据无误') else: # 数据存在差异:开始同步 # 壁纸index重置 images_index = 0
# 同步数据 print('数据存在差异:开始同步新数据') winreg.SetValueEx(CreateKey, 'online_data', 0, winreg.REG_SZ, json.dumps(global_data)) # winreg.CloseKey(CreateKey) print('本地数据同步完成')
# 同步文件 print('数据存在差异:开始同步新文件') old_file_cleanup() print('开始同步新文件') for index in range(len(global_data['data'])): # 根据data里的元素数量逐个下载文件 file_data = global_data['data'][index] if isConnected(2, file_data['url']): # 判断文件下载url是否有效 downloadFile(file_data['name'], file_data['url']) print('全部文件下载完毕')
# 首次运行配置数据修复模块def repair_config(): print('config配置信息开始修复') try: # 写入reg winreg.SetValueEx(CreateKey, 'config', 0, winreg.REG_SZ, json.dumps(default_config)) print('config配置信息修复完毕') except: print("Error:[配置数据修复模块]发生未知错误")
# 配置数据获取模块def get_config(config_item_name): try: key = winreg.OpenKey(win32con.HKEY_CURRENT_USER, program_reg_path, 0, win32con.KEY_ALL_ACCESS) config_data, type = winreg.QueryValueEx(key, "config") data = json.loads(config_data) return data[config_item_name] except FileNotFoundError: print('Warning:config为空') repair_config() return 0 except: print("Error:reg无法读取config")
# 配置数据修改模块def set_config(config_item_name, value): try: # 先读取config key = winreg.OpenKey(win32con.HKEY_CURRENT_USER, program_reg_path, 0, win32con.KEY_ALL_ACCESS) config_data, type = winreg.QueryValueEx(key, "config") data = json.loads(config_data) # 再修改config data[config_item_name] = value # 写入reg winreg.SetValueEx(CreateKey, 'config', 0, winreg.REG_SZ, json.dumps(data)) except FileNotFoundError: print('Error:set_config config读取失败') except: print("Error:[配置数据修改模块]发生未知错误")
# 管理员权限判断模块def is_admin(): try: return ctypes.windll.shell32.IsUserAnAdmin() except: return False
## ////////////////////////////////////////////////////////run区////////////////////////////////////////////////////////
def start(): global global_data
if global_data is None: # 判断运行条件是否满足 # print('没有获取到数据,不满足运行条件,程序退出') print('初次运行,先等待5分钟(直到与服务器通信恢复)') time.sleep(5) start() else: # 有数据,运行条件满足(程序非第一次运行没有网络) print('网络已连接,开始同步数据') if global_data['status'] == 1: # 启动 print('程序启用状态') data_synchronization() else: print('程序关闭状态') exit() print('所有程序运行完毕,结束进程')
def run(): global global_data global images_index
global_data = get_json(0) print(global_data)
data = global_data images_index = get_config('images_index')
start() # 启动时第一次同步数据
# 启动线程 schedule.every(data['update_time']).seconds.do(data_synchronization) schedule.every(data['refresh_time']).seconds.do(wallpaper) print('当前更新速度' + str(data['update_time'])) print('当前刷新速度' + str(data['refresh_time'])) print('上次运行images_index:' + str(images_index)) print('程序初始化完毕', '/' * 300)
# 线程计时器 while True: schedule.run_pending() time.sleep(1)
## ////////////////////////////////////////////////////////启动区////////////////////////////////////////////////////////if is_admin(): print("以管理员权限运行") run()else: if sys.version_info[0] == 3: print('没有管理员权限:启动admin线程') ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, __file__, None, 0) # 1:前台运行 0:后台运行 print('user权限运行结束')API格式(json):
{ "time": 1664757166, "status": 1, "type": 2, "update_time": 3600, "refresh_time": 5, "style": { "WallpaperStyle": 1, "TileWallpaper": 0 }, "data": [ { "name": "jacksen168_Wallpaper_021_LOGO.jpg", "url": "https://jacksen168.top/img/last.jpg" } ]}含义
| 名称 | 含义 | 值 |
|---|---|---|
| time | 时间戳(可用于程序检查是否需要更新) | 默认时间戳 |
| status | 程序状态(程序的状态开关) | 0(关闭)/1(开启) |
| type | 程序更换壁纸类型(普通=win10设置中的背景修改) | 1(普通更换)/2(防修改更换) |
| update_time | 检查更新时间(毫秒) | 时间(毫秒) |
| refresh_time | 壁纸刷新时间(毫秒) | 时间(毫秒) |
| style->WallpaperStyle | 更换壁纸样式(对应win10设置中的背景契合度) | 0=居中 ,1=平铺 ,2=拉伸 |
| style->TileWallpaper | 无 | 兼容type=1模式,无含义 |
| data->[]->name | 保存到本地图片的名称 | 图片.jpg/图片.png |
| data->[]->url | 需要下载的图片网址(url) | 例子: http://baidu.com/LOGO.jpg |
{callout color=“#f0ad4e”} type=2: style->WallpaperStyle值说明: 0[居中] = 如果图片与屏幕分辨率不同会出现 黑边/显示不全 1[平铺] = 如果图片与屏幕分辨率不同会出现 多张平铺/显示不全 2[拉伸] = 如果图片与屏幕比例不同则会拉伸变形,反之相同则能无视分辨率完美贴合边缘显示 {/callout}
data与普通版一样是个数组,同样可选择多张壁纸进行循环播放
文章分享
如果这篇文章对你有帮助,欢迎分享给更多人!
根据API更换Windows壁纸项目[python]
https://blog.jacksen168.top/posts/windows-wallpaper-api-change-project-python/ 相关文章 智能推荐
1
python替换win10壁纸:对网上主流方法的补充
文档 python替换win10壁纸: 对网上主流方法的补充
2
Bili Images Uploader
项目 Bili Images Uploader - 将图片上传到B站图床并通过评论实现持久化存储
3
关于VSCode Git GPG签名开机第一次提交失败的探究
文档 探究并解决VSCode中使用GPG签名提交Git时,开机后第一次提交报错,第二次才能正常弹出密码框的问题
4
关于如何在程序中判断Windows系统自带的移动热点是否开启解决思路
文档 关于如何在程序中判断Windows系统自带的移动热点是否开启解决思路
5
对于wallpaper engine软件的一些研究
文档 对于wallpaper engine软件的一些研究,稍微深入了解一下wallpaper engine软件的配置文件与软件行为的关联
随机文章 随机推荐