2024-04-24 10:16:27 发布
网友
在python2.5或更高版本的Windows上,使用ctypes加载user32.dll,并使用SPI_SETDESKWALLPAPER操作调用^{}。
例如:
import ctypes SPI_SETDESKWALLPAPER = 20 ctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, "image.jpg" , 0)
对于Python3.5,系统参数sinfoa不起作用。使用SystemParametersInfoW。
import ctypes ctypes.windll.user32.SystemParametersInfoW(20, 0, "absolute path" , 0)
在gnome桌面上,通常使用gconf来完成这项工作,可以直接调用gconftool,也可以使用gconf python模块。后者在联合国大学提供的链接中。第一种方法可以这样做。
import commands command = "gconftool-2 --set /desktop/gnome/background/picture_filename --type string '/path/to/file.jpg'" status, output = commands.getstatusoutput(command) # status=0 if success
在python2.5或更高版本的Windows上,使用ctypes加载user32.dll,并使用SPI_SETDESKWALLPAPER操作调用^{} 。
例如:
对于Python3.5,系统参数sinfoa不起作用。使用SystemParametersInfoW。
在gnome桌面上,通常使用gconf来完成这项工作,可以直接调用gconftool,也可以使用gconf python模块。后者在联合国大学提供的链接中。第一种方法可以这样做。
相关问题 更多 >
编程相关推荐