我使用Python中提供的解决方案将this桌面墙纸从Python.
特别地,下面是代码示例
import ctypes
import os
image_file = "myimage.jpg"
print("Setting the wallpaper")
SPI_SETDESKWALLPAPER = 20
ctypes.windll.user32.SystemParametersInfoW(SPI_SETDESKWALLPAPER, 0, os.path.abspath(image_file) , 0)问题是,这种变化是不持久的,因为每当我重新启动电脑时,桌面墙纸就会被重置。如何从Python中永久更改Windows桌面墙纸?
我使用python 3.5
发布于 2017-06-07 15:27:06
你需要这样命名它
print("Setting the wallpaper")
SPI_SETDESKWALLPAPER = 20
SPIF_UPDATEINIFILE = 1
ctypes.windll.user32.SystemParametersInfoW(SPI_SETDESKWALLPAPER, 0, os.path.abspath(image_file) , SPIF_UPDATEINIFILE)还可以查看相关的documentation
https://stackoverflow.com/questions/44405337
复制相似问题