Set the Desktop Background

Paul Thompson Paul Thompson is offline Offline Mar 23rd, 2009, 4:28 am |
0
This is a simple program and all it does is fiddle with the registry and set the value of the desktop background to be the bmp file that you supply in the function. There are other things you can do with the windows registry, this is just one of the easy things that demonstrates how it all works.

Enjoy
Quick reply to this message  
Python Syntax
  1. import win32api, win32con, win32gui
  2.  
  3. def setBackground(image):
  4. key = win32api.RegOpenKeyEx(win32con.HKEY_CURRENT_USER,"Control Panel\\Desktop",0,win32con.KEY_SET_VALUE)
  5. win32api.RegSetValueEx(key, "WallpaperStyle", 0, win32con.REG_SZ,"0")
  6. win32api.RegSetValueEx(key, "TileWallpaper", 0, win32con.REG_SZ,"0")
  7. win32gui.SystemParametersInfo(win32con.SPI_SETDESKWALLPAPER, image, 1+2)
0
shadwickman shadwickman is offline Offline | Mar 30th, 2009
It would be nice if you explained the code above rather than just plopping it down on the page.
 
 

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC