Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/282.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Python中更改桌面墙纸_Python_Python 3.x_Wallpaper - Fatal编程技术网

在Python中更改桌面墙纸

在Python中更改桌面墙纸,python,python-3.x,wallpaper,Python,Python 3.x,Wallpaper,几个小时以来,我一直在尝试使用ctypes.windell.user32.systemparameters sinfoa在Python中更改Windows7中的桌面墙纸,但没有成功。我已经搜索了好几个来源,没有一个能在我的系统上运行的解决方案 以下片段对墙纸没有影响: ctypes.windll.user32.SystemParametersInfoA(20, 0, "image.jpg", 0) image.jpg有效 另外,如果有任何帮助,print(ctypes.windell.user

几个小时以来,我一直在尝试使用ctypes.windell.user32.systemparameters sinfoa在Python中更改Windows7中的桌面墙纸,但没有成功。我已经搜索了好几个来源,没有一个能在我的系统上运行的解决方案

以下片段对墙纸没有影响:

ctypes.windll.user32.SystemParametersInfoA(20, 0, "image.jpg", 0)
image.jpg
有效

另外,如果有任何帮助,
print(ctypes.windell.user32.systemparameters sinfoa(20,0,“image.jpg”,0))
返回0


我正在使用Python 3.4。非常感谢您的帮助。

您是否尝试过此方法:?
0
返回值表示失败。调用
GetLastError()
raisewinerror()
)。请尝试
系统参数sinfow
(Unicode),并从中获取答案。请确保指定图像的完整路径,并且如果您手动更改背景,图像可以正常工作。我提供了类似问题的示例答案。