944,103 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Unsolved
  • Views: 2929
  • Python RSS
Jul 28th, 2007
0

how to change desktop by python

Expand Post »
I want to change my desktop by writing a python program,can somebody help me ?thanks so much!
Similar Threads
Reputation Points: 10
Solved Threads: 1
Newbie Poster
newharvar is offline Offline
6 posts
since Apr 2007
Jul 28th, 2007
0

Re: how to change desktop by python

i know this can do
import ctypes
import Image
# -*- coding: cp936 -*-

STOREDIR = './img'

def setWallpaperFromBMP(imagepath):
SPI_SETDESKWALLPAPER = 20 # According to http://support.microsoft.com/default.aspx?scid=97142
ctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, imagepath , 0) #SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE

def setWallPaper(imagePath):
"""Given a path to an image, convert it to bmp and set it as wallpaper"""
bmpImage = Image.open(imagePath)
newPath = STOREDIR + 'mywallpaper.bmp'
bmpImage.save(newPath, "BMP")
setWallpaperFromBMP(newPath)

filename="./girl6.jpg"
setWallPaper(filename)

but it seems not so good,somebody who know how to get the point of iactivedesktop?
Reputation Points: 10
Solved Threads: 1
Newbie Poster
newharvar is offline Offline
6 posts
since Apr 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: Help Needed With Simple Code
Next Thread in Python Forum Timeline: LED Clock using wxPython





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


Follow us on Twitter


© 2011 DaniWeb® LLC