我正在尝试运行一个python脚本来下载一个图像并通过一个脚本更改桌面背景。下载图像部分,如果可以,但我有麻烦实际改变与python墙纸。我试图使用this command,但它实际上不起作用。下面是我的尝试
subprocess.call(["defaults", "write", "com.apple.Desktop", "background", 'default=/Users/pathtomyname/img.jpg'])
SCRIPT = """/usr/bin/osascript<<END
tell application "Finder"
set desktop picture to POSIX file "%s"
end tell
END"""
def set_desktop_background(filename):
subprocess.Popen(SCRIPT%filename, shell=True)
目前没有回答
相关问题 更多 >
编程相关推荐