| | |
how to change desktop by python
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Apr 2007
Posts: 6
Reputation:
Solved Threads: 1
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?
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?
![]() |
Similar Threads
- Program to change desktop background (C++)
- Can't change desktop/180Solutions Adware (Viruses, Spyware and other Nasties)
- Desktop background now white and unable to change (Viruses, Spyware and other Nasties)
- Cannot change desktop background (Viruses, Spyware and other Nasties)
- Spyware attack - Unable to change desktop background (Viruses, Spyware and other Nasties)
- Can't change my desktop theme - get rundll32.exe (Viruses, Spyware and other Nasties)
Other Threads in the Python Forum
- Previous Thread: Help Needed With Simple Code
- Next Thread: LED Clock using wxPython
Views: 1761 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for Python
address ansi backend beginner changecolor class code conversion coordinates copy curves customdialog dan08 dictionary digital directory dynamic edit editing events examples excel feet file float font format ftp function generator getvalue gui halp homework i/o images import info input ip java line linux list lists loop mouse mysql newb number numbers output panel parsing path port prime print program programming projects py2exe pygame pyqt python queue random rational recursion recursive screensaverloopinactive scrolledtext server ssh stamp statictext string strings sudokusolver table terminal text thread threading time tkinter tlapse tuple tutorial type ubuntu unicode url urllib urllib2 variable whileloop windows write wxpython





