how to change desktop by python

Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Apr 2007
Posts: 6
Reputation: newharvar is an unknown quantity at this point 
Solved Threads: 1
newharvar newharvar is offline Offline
Newbie Poster

how to change desktop by python

 
0
  #1
Jul 28th, 2007
I want to change my desktop by writing a python program,can somebody help me ?thanks so much!
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 6
Reputation: newharvar is an unknown quantity at this point 
Solved Threads: 1
newharvar newharvar is offline Offline
Newbie Poster

Re: how to change desktop by python

 
0
  #2
Jul 28th, 2007
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?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Python Forum


Views: 1761 | Replies: 1
Thread Tools Search this Thread



Tag cloud for Python
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC