3

I have been recently using this code to change my windows desktop wallpaper:

import win32api, win32con, win32gui

def setWallpaper(path):
    key = win32api.RegOpenKeyEx(win32con.HKEY_CURRENT_USER,
                                "Control Panel\\Desktop",
                                0,win32con.KEY_SET_VALUE)
    win32api.RegSetValueEx(key, "WallpaperStyle", 0, win32con.REG_SZ, "0")
    win32api.RegSetValueEx(key, "TileWallpaper", 0, win32con.REG_SZ, "0")
    win32gui.SystemParametersInfo(win32con.SPI_SETDESKWALLPAPER, path, 1+2)

path = r'mypath\image.jpg'
setWallpaper(path)

Is there a way in Python to change a certain monitor wallpaper? Because I have a dual monitor setup and like to have a different image on each screen, I did a bit of searching but couldn't find anything. I am using python 3.4.4 on windows 10.

EDIT: Ideally I would like to not have to join the images together as I have this code running in another program which runs like a random slideshow and by doing the joining images then I would have to join the images in every possible combination.

martineau
  • 119,623
  • 25
  • 170
  • 301
  • that answer involves joining the images together, i would rather not do that if it can be avoided –  Dec 30 '16 at 13:39
  • 1
    Seems that this link has a script that does the job: http://gabbpuy.blogspot.fr/2010/07/set-windows-wallpaper-from-python-for.html – fredtantini Dec 30 '16 at 13:52
  • that seems to be over comlicating it. surely there must be a much more simpler way? –  Dec 30 '16 at 14:09

0 Answers0