2

I've been trying for several hours to change the desktop wallpaper in Windows 7 in Python using ctypes.windll.user32.SystemParametersInfoA with no avail. I have searched several sources and none have had a solution that worked on my system.

The following fragment has no effect on wallpaper:

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

image.jpg is valid.

Also, if it's any help, print (ctypes.windll.user32.SystemParametersInfoA(20, 0, "image.jpg", 0)) returns 0.

I'm using Python 3.4. Any help is greatly appreciated.

  • Have you tried this: http://stackoverflow.com/questions/16943733/change-windows-background-from-python ? – anon582847382 Apr 07 '14 at 08:31
  • 1
    `0` return value means failure. Call `GetLastError()` (`raise WinError()`). Try `SystemParametersInfoW` (Unicode) with the answer from [Change wallpaper in Python for user while being system](http://stackoverflow.com/q/14426475/4279). Make sure to specify the full path to the image and that the image works if you change the background manually. – jfs Apr 07 '14 at 09:22
  • I provided answer with example for similar SO question. [change desktop background](http://stackoverflow.com/questions/1977694/change-desktop-background/37669111#37669111) – Vlad Bezden Jun 07 '16 at 13:38

0 Answers0