python - 如何使用 python 更改我的桌面背景?

标签 python background desktop

如何使用 python 更改我的桌面背景?

我想在 Windows 和 Linux 上都这样做。

最佳答案

在带有 python2.5 或更高版本的 Windows 上,使用 ctypes 加载 user32.dll 并调用 SystemParametersInfo()使用 SPI_SETDESKWALLPAPER 操作。

例如:

import ctypes
SPI_SETDESKWALLPAPER = 20 
ctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, "image.jpg" , 0)

关于python - 如何使用 python 更改我的桌面背景?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1977694/

相关文章:

javascript - 检查图像是否存在与多个背景图像

c++ - VC++改变桌面背景的方法

AndroidRuntime:致命异常: main (libGDX

python - Django - 更新主键字符字段重复实例

svg - 带有彩色背景的透明图标 svg 或 <i> 标签

python - 如何创建一个下拉菜单来更改用于为分区统计图着色的列? ( plotly 快报)

多个背景图像上的 CSS 背景大小

Silverlight OOB 图标未出现在 Windows 8 桌面上

python - Scrapy - 在第一次请求后禁用 Selenium

python - 将模型导出到 PMML