Ⅰ ubuntu 下用python寫了個生成動態壁紙的腳本,如果通過代碼實現使用這個xml,而不是通過桌面->背景->添加
sudo mkdir /usr/share/backgrounds/mybackground-imgs
sudo cd /usr/share/backgrounds/mybackground-imgs
sudo cp /home/你的背景圖片所在目錄/* .
sudo ./backgroud.py
其中backgroud.py:
#!/usr/bin/env python
#coding=utf-8
import glob, os
import shutil
import time
import Image
filelist=[]
def filelie(path):
if os.path.isfile(path):
wenjian=os.path.splitext(path)[1][1:]
if wenjian=="jpg" or wenjian=="png" or wenjian=="gif":
try:
kuan,gao = Image.open(path).size
if kuan>=1024 and gao>=768:
filelist.append(path)
except IOError:
pass
elif os.path.isdir(path):
for item in os.listdir(path):
itemsrc = os.path.join(path, item)
filelie(itemsrc)
curdir = os.getcwd()
filelie(curdir)
currentImageFiles = filelist
#print filelist
if os.path.isfile('backgroundslide.xml'):
os.remove('backgroundslide.xml')
currentTime = time.localtime()
length = len(currentImageFiles)
f = file('backgroundslide.xml', 'w')
f.write('<background>\n')
f.write('\t<starttime>\n')
f.write('\t\t<year>' + str(currentTime.tm_year) + '</year>\n')
f.write('\t\t<month>' + str(currentTime.tm_mon) + '</month>\n')
f.write('\t\t<day>' + str(currentTime.tm_mday) + '</day>\n')
f.write('\t\t<hour>' + str(currentTime.tm_hour) + '</hour>\n')
f.write('\t\t<minute>' + str(currentTime.tm_min) + '</minute>\n')
f.write('\t\t<second>' + str(currentTime.tm_sec) + '</second>\n')
f.write('\t</starttime>\n')
f.write('<!--This animation will start at the time it created-->\n')
for i in currentImageFiles:
length = length - 1
f.write('\t<static>\n')
f.write('\t\t<ration>550.0</ration>\n')
f.write('\t\t<file>' + currentImageFiles[length] +'</file>\n')
f.write('\t</static>\n')
f.write('\t<transition>\n')
f.write('\t\t<ration>25.0</ration>\n')
f.write('\t\t<from>' + currentImageFiles[length] + '</from>\n')
if length >= 1:
f.write('\t\t<to>' + currentImageFiles[length-1] + '</to>\n')
if length <1:
f.write('\t\t<to>' + currentImageFiles[len(currentImageFiles)-1] + '</to>\n')
f.write('\t</transition>\n')
f.write('</background>\n')
f.close()
Ⅱ 如何快速切換電腦的桌面壁紙
1、電腦桌面上,右擊桌面,在右擊彈出菜單中點擊「個性化」,在個性化界面中點擊左下角的「桌面背景」
5、還有兩個可勾選選項分別是「無序播放」和「使用電池時是否暫停」,你可根據個人喜好自己設置