小编Joh*_*ith的帖子

在 Python 3 中更改 Windows 10 背景

我一直在寻找通过 python 脚本更改 Windows 10 桌面壁纸的最佳方法。当我尝试运行此脚本时,桌面背景变为纯黑色。

import ctypes

path = 'C:\\Users\\Patrick\\Desktop\\0200200220.jpg'

def changeBG(path):
    SPI_SETDESKWALLPAPER = 20
    ctypes.windll.user32.SystemParametersInfoA(20, 0, path, 3)
    return;

changeBG(path)
Run Code Online (Sandbox Code Playgroud)

我能做些什么来解决这个问题?我正在使用 python3

python windows ctypes python-3.x windows-10

6
推荐指数
1
解决办法
3470
查看次数

标签 统计

ctypes ×1

python ×1

python-3.x ×1

windows ×1

windows-10 ×1