System Independent Wallpaper Changer

Terrance N. Phillip mediocre_person at hotmail.com
Tue Jul 5 20:12:37 EDT 2005


This is what I've got... the code should work on a typical Windows 
system, I think...
============================================
import os
import random
import time

# I'm not sure what to expect for Win98, WinME, etc. I've
# only tried it with xp...
if os.name in ['nt', 'win98', 'me']:
     osWindows = True
     import ctypes
     import win32con
     import Image
     pth = 'c:/path/to/wallpapers'
else:
     osWindows = False
     pth = '~/path/to/wallpapers'

picfiles = os.listdir(pth)

while True:
     jpg = random.choice(picfiles)
     if os_type = 'W':
         bmp = 'c:/wallpaper.bmp'
         Image.open(pth+jpg).save(bmp)
         cs = ctypes.c_buffer(bmp)
         ok = 
ctypes.windll.user32.SystemParametersInfoA(win32con.SPI_SETDESKWALLPAPER,0,cs,0)
     else:
         pass
         ' set kde wallpaper to jpg  <------------- *** ---
     time.sleep(60)
=================================================

I've done some searching, and can't seem to find a programatic way of 
getting *** that to happen.

Thanks for any advice.

Nick.



More information about the Python-list mailing list