Home
Categories
WIKI
Topic
User
LANGUAGE:
中文
English
切换壁纸的脚本
Apps Section
1128
views ·
3
replies ·
To
floor
Go
leixiaozeng
deepin
2016-12-20 17:21
Author
点题,一个切换壁纸的小脚本,用python3写的
脚本内容如下:
-----------------------------------------------------优雅的分隔线--------------------------------------------------------------
#!/usr/bin/python3
import os
import random
#壁纸目录
dir = "/home/lei/Pictures/风景/"
#更新壁纸
def update():
list = os.listdir(dir)
l = len(list)-1
ran = random.randint(0,l)
filename = list[ran]
os.system('gsettings set org.gnome.desktop.background picture-uri ' + dir+filename)
update()
-----------------------------------------------------优雅的分隔线--------------------------------------------------------------
复制上面的内容保存为.py的格式,名字随意,
一 ,-×- 壁纸目录修改成自己的图片存放目录 -×-
二,右键属性
允许以程序执行
,
或者
在命令行里,加上
chome +x *.py
三,进入快捷键里设置
快捷键
四,名称随便起,命令前面照抄,后面的路径要改为你自己存放脚本的位置就行了。
、
五,设置快捷键
我设置的快捷键是 controt+alt+down你的呢?
分享是一种美德,一起去,糟蹋PYTHON吧,哦不,一起去学习Python吧!
Reply
Like 0
Favorite
View the author
All Replies
Lyvnee
deepin
2016-12-20 18:19
#1
你还可以设个定时任务
Reply
Like 0
View the author
leixiaozeng
deepin
2016-12-20 18:49
#2
https://bbs.deepin.org/post/133211
你还可以设个定时任务
我也是想的,本来想用corntab实现,可是捣鼓半天就是没有成功过,我就放弃了,
Reply
Like 0
View the author
Humor
deepin
2016-12-27 21:58
#3
谢谢楼主分享
Reply
Like 0
View the author
Please
sign
in first
Featured Collection
Change
Nuntia - Modern IMAP/SMTP mail client for Deepin (Beta tester wanted!)
[Tutorial] deepin25 WSL Offline Installation Guide
UOS AI 2.8 Released! Three New Intelligent Agents & Major Evolution
Solid Q&A | deepin 25 Common Questions – The Immutable System Edition
New Thread
Popular Ranking
Change
Adding a Dancing Spectrum Bar to the Deepin Taskbar | deepin-spectrum
Popular Events
More
脚本内容如下:
-----------------------------------------------------优雅的分隔线--------------------------------------------------------------
#!/usr/bin/python3
import os
import random
#壁纸目录
dir = "/home/lei/Pictures/风景/"
#更新壁纸
def update():
list = os.listdir(dir)
l = len(list)-1
ran = random.randint(0,l)
filename = list[ran]
os.system('gsettings set org.gnome.desktop.background picture-uri ' + dir+filename)
update()
-----------------------------------------------------优雅的分隔线--------------------------------------------------------------
复制上面的内容保存为.py的格式,名字随意,
一 ,-×- 壁纸目录修改成自己的图片存放目录 -×-
二,右键属性允许以程序执行,或者在命令行里,加上 chome +x *.py
三,进入快捷键里设置快捷键
四,名称随便起,命令前面照抄,后面的路径要改为你自己存放脚本的位置就行了。
五,设置快捷键
我设置的快捷键是 controt+alt+down你的呢?
分享是一种美德,一起去,糟蹋PYTHON吧,哦不,一起去学习Python吧!