導航:首頁 > 編程語言 > 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如何設置壁紙相關的資料

熱點內容
光大的app叫什麼 瀏覽:112
單片機excel文檔 瀏覽:973
pdf軟體官方下載中文版 瀏覽:416
儲存空間其他文件夾 瀏覽:390
科技時尚資訊加密貨幣的新崛起 瀏覽:748
易筋洗髓pdf 瀏覽:51
方舟編譯器和ufs3 瀏覽:78
電腦編程入門自學資料 瀏覽:831
vscode文件夾是暗的 瀏覽:876
精品源碼交易靠譜點的平台 瀏覽:290
linux系統後門 瀏覽:411
軟體顯示無法連接到遠程伺服器怎麼辦 瀏覽:918
小衛星鍋加密 瀏覽:208
按鍵手機版熱更新源碼 瀏覽:656
怎麼拷貝加密門禁卡到手機 瀏覽:917
ghost壓縮系統 瀏覽:807
程序員電腦圖片簡筆畫 瀏覽:102
添加uboot命令 瀏覽:632
ue4編譯速度掃描磁碟 瀏覽:827
下載小說和文件夾 瀏覽:139