2
我正在爲自己開發一個小型項目,並且我碰到了一堵牆。我需要在Windows 10 64位上更改桌面背景。我試圖使用下面的腳本來改變基於本地圖像的背景。代碼執行時沒有錯誤,但桌面只是變黑。我加倍檢查,我的圖像在c:\CuratedWallpaper\Mario.bmp
,所以這不是問題。通過python在windows 10中更改桌面背景
import ctypes
directory = "c:\CuratedWallpaper"
imagePath = directory + "\Mario.bmp"
def changeBG(imagePath):
SPI_SETDESKWALLPAPER = 20
ctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, imagePath , 0)
return;
changeBG(imagePath)
你能解釋你使用的最後一個參數嗎? – finngu