944,055 Members | Top Members by Rank

Ad:
  • Python Code Snippet
  • Views: 2451
  • Python RSS
0

Set the Desktop Background

by on Mar 23rd, 2009
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
Python Code Snippet (Toggle Plain Text)
  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)
Comments on this Code Snippet
Mar 30th, 2009
0

Re: Set the Desktop Background

It would be nice if you explained the code above rather than just plopping it down on the page.
Posting Pro in Training
shadwickman is offline Offline
495 posts
since Jul 2007
Message:
Previous Thread in Python Forum Timeline: password when connect to bluetooth module >.<
Next Thread in Python Forum Timeline: Option mining using python





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC