How to Change Windows background using Python 2.7.3

前端 未结 2 756
梦谈多话
梦谈多话 2021-01-25 19:39

I am using windows 8 (not yet updated to 8.1)

The code I am using is

import ctypes

SPI_SETDESKWALLPAPER = 20

ctypes.windll

相关标签:
2条回答
  • 2021-01-25 19:55

    Try passing SPIF_SENDCHANGE (which is 2) as the last parameter. You might also need to bitwise-or it with SPIF_UPDATEINIFILE (which is 1).

    0 讨论(0)
  • 2021-01-25 19:57

    Sorry, I know this is late, but the problem is that you need to include the path. Instead of "image.jpg" do r"C:\path to file\image.jpg" Otherwise python doesn't know where to look for the image.

    0 讨论(0)
提交回复
热议问题