这就是我想:如何在python中设置桌面背景? (窗口)
import ctypes
import os
drive = "F:\\"
folder = "Keith's Stuff"
image = "midi turmes.png"
image_path = os.path.join(drive, folder, image)
SPI_SETDESKWALLPAPER = 20
ctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, image_path, 3)
Basicaly,这段代码显然是应该设置桌面背景,以MIDI turmes.png,它改变了桌面,但是,对于一些奇怪的原因,它总是一个绿色的背景(我在Windows中的个性化设置是图像背后的绿色背景)我该如何解决这个问题,并使桌面看起来像这样?:http://i.imgur.com/VqMZF6H.png
你试过使用JPG图像而不使用PNG吗? –
Python 2或3?另外尝试设置函数的argtypes和restype。 –
是的,我试过了。我正在使用python 3.5.2 – BadArtistKeith