導航:首頁 > 編程語言 > python如何設置壁紙

python如何設置壁紙

發布時間:2025-07-10 18:25:22

Ⅰ 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、還有兩個可勾選選項分別是「無序播放」和「使用電池時是否暫停」,你可根據個人喜好自己設置

閱讀全文

與python如何設置壁紙相關的資料

熱點內容
精品源碼交易靠譜點的平台 瀏覽:288
linux系統後門 瀏覽:409
軟體顯示無法連接到遠程伺服器怎麼辦 瀏覽:916
小衛星鍋加密 瀏覽:208
按鍵手機版熱更新源碼 瀏覽:656
怎麼拷貝加密門禁卡到手機 瀏覽:917
ghost壓縮系統 瀏覽:805
程序員電腦圖片簡筆畫 瀏覽:102
添加uboot命令 瀏覽:630
ue4編譯速度掃描磁碟 瀏覽:827
下載小說和文件夾 瀏覽:137
杭州上城編程入門 瀏覽:865
我的世界如何玩伺服器多人 瀏覽:554
linuxtopcpu100 瀏覽:405
命令分兩種 瀏覽:666
linuxnfs搭建 瀏覽:267
有什麼買工具的app 瀏覽:855
集群伺服器如何批量管理 瀏覽:12
命令行等待 瀏覽:230
vivo手機如何看加密照片 瀏覽:938