System Independent Wallpaper Changer

Chris Lambacher lambacck at gmail.com
Wed Jul 6 04:26:59 CEST 2005


you probably want
if sys.platform == 'win32':

instead of
if os.name in ['nt', 'win98', 'me']:

-Chris
On 7/5/05, Terrance N. Phillip <mediocre_person at hotmail.com> wrote:
> 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.
> --
> http://mail.python.org/mailman/listinfo/python-list
> 


-- 
Christopher Lambacher
lambacck at computer.org



More information about the Python-list mailing list