如何使用 python 更改我的桌面背景? [英] How can I change my desktop background with python?
本文介绍了如何使用 python 更改我的桌面背景?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用 python 更改我的桌面背景?
How can I change my desktop background with python?
我想在 Windows 和 Linux 上都这样做.
I want to do it in both Windows and Linux.
推荐答案
在python2.5或更高版本的Windows上,使用ctypes加载user32.dll并调用SystemParametersInfo()
与 SPI_SETDESKWALLPAPER 操作.
On Windows with python2.5 or higher, use ctypes to load user32.dll and call SystemParametersInfo()
with SPI_SETDESKWALLPAPER action.
例如:
import ctypes
SPI_SETDESKWALLPAPER = 20
ctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, "image.jpg" , 0)
这篇关于如何使用 python 更改我的桌面背景?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文