2024-04-25 21:03:43 发布
网友
实际上,我正在用Python创建一个自动墙纸变换器,并且我已经创建了使用Unsplash API获取墙纸的函数,但问题是我dnt knw如何将其设置为墙纸,我认为对于设置墙纸,我必须更改一些内容,但我dnt knw主要的问题是我dnt knw如何设置在windows 10中使用python的墙纸。我是一名初学者,需要您的帮助。如果您能帮助我,我将非常感谢您。
这是一个解决方案,在Windows10上的python3中为我工作
import os import ctypes path_user = os.path.expanduser('~') print(path_user) # this print C:\Users\yourusername name_of_file = 'test.png' path_to_file = os.path.join(path_user, name_of_file) print(path_to_file) # this print C:\Users\username\test.png SPI_SETDESKWALLPAPER = 20 ctypes.windll.user32.SystemParametersInfoW(SPI_SETDESKWALLPAPER, 0, path_to_file, 0)
这是一个解决方案,在Windows10上的python3中为我工作
相关问题 更多 >
编程相关推荐