如何使用Python 3.6在Windows 10中设置墙纸?

问题描述

我从堆栈溢出中看到了一些示例,但是当我运行该程序时,我也无法设置Windows 10桌面的背景,但是我将背景更改为黑色,谁能告诉我如何使用python3.6设置背景 或告诉我我的代码有什么错误

import ctypes
SPI_SETDESKWALLPAPER = 20
ctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER,'image.jpg',3)

解决方法

import ctypes

ctypes.windll.user32.SystemParametersInfoW(20,"c:\\path\\to\\image.jpg",0)