【问题标题】:How to set wallpaper in windows 10 using Python 3.6? [duplicate]如何使用 Python 3.6 在 Windows 10 中设置壁纸? [复制]
【发布时间】:2020-12-25 22:25:25
【问题描述】:

我已经看到堆栈溢出的示例,但是当我运行该程序时,我也无法设置 Windows 10 桌面的背景,我的背景更改为黑色,谁能告诉我如何使用 python3.6 设置背景 或者告诉我我的代码有什么错误

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

【问题讨论】:

  • 用绝对路径试试?
  • 请用代码说明

标签: python windows-10 ctypes


【解决方案1】:
import ctypes

ctypes.windll.user32.SystemParametersInfoW(20, 0, "c:\\path\\to\\image.jpg" , 0)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-10-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多