Related Entries

India PyCon 2009
Load testing with Grinder
Adding namespace to XML
Opera RSS to OPML
Soup is beautiful

« Load testing with Grinder
» Prototyping GUI/Web Applications using Spreadsheet

Quick wallpaper changer

Silly python. Change wallpaper.

There are a whole bunch of fancy wallpaper changers for WindowsTM out there. Most of them run in the background - and I am wary of background processes. Since I use bblean, and bblean (or equivalently, blackbox/fluxbox etc on Linux) comes with utilities like bsetroot that can set the wallpaper; it was a simple matter to whip up a silly Python script that picks up a random image file from a directory and call bsetroot. Put this as a WindowsTM scheduled task to run every 10 minutes or so.

Don’t you love Python’s list functions?

from glob import glob
from random import choice
from os import system
picdir="d:\\vsbabu\\My Pictures\\vista\\"
setbg="c:\\bblean\\bsetroot.exe"
picfiles = glob(picdir + "*.jpg")
picfiles.append(glob(picdir + "*.gif"))
picfiles.append(glob(picdir + "*.png"))
system("""%s -full "%s" """ % (setbg,choice(picfiles)))