导航:首页 > 编程语言 > 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压缩系统 浏览:807
程序员电脑图片简笔画 浏览:102
添加uboot命令 浏览:632
ue4编译速度扫描磁盘 浏览:827
下载小说和文件夹 浏览:137
杭州上城编程入门 浏览:865
我的世界如何玩服务器多人 浏览:554
linuxtopcpu100 浏览:405
命令分两种 浏览:666
linuxnfs搭建 浏览:267
有什么买工具的app 浏览:855
集群服务器如何批量管理 浏览:12
命令行等待 浏览:230
vivo手机如何看加密照片 浏览:938