Alex Rivera | Logout

How can I change my desktop background with python?

Asked 2009-12-30T00:02:26.233
53

How can I change my desktop background with python?

I want to do it in both Windows and Linux.

Edit
Report

1 Answer

14

On a gnome desktop, you usually do this with gconf, either directly calling gconftool or using the gconf python module. The latter is in the link given by unutbu. The first method could be done like this.

import commands
command = "gconftool-2 --set /desktop/gnome/background/picture_filename --type string '/path/to/file.jpg'"
status, output = commands.getstatusoutput(command)  # status=0 if success
answered 2009-12-30T07:11:42.890

Your Answer