使用pythonwin设置windows的桌面背景
2016-03-30 15:22
621 查看
#coding=utf-8 __author__ = 'Administrator' import pythoncom from win32com.shell import shell, shellcon g_desk = None def toGBK(s): return s.decode('utf-8').encode('gb2312') def getDeskComObject(): global g_desk if not g_desk: g_desk = pythoncom.CoCreateInstance(shell.CLSID_ActiveDesktop, \ None, pythoncom.CLSCTX_INPROC_SERVER, \ shell.IID_IActiveDesktop) return g_desk def setWallPaper(paper): desktop = getDeskComObject() if desktop: desktop.SetWallpaper(toGBK(paper), 0) desktop.ApplyChanges(shellcon.AD_APPLY_ALL) def addUrlLink(lnk): desktop = getDeskComObject() desktop.AddUrl(0, lnk, 0, 0) if __name__ == '__main__': paper = r'G:\meinv\长腿美女刘奕宁Lynn唯美私房照\16.jpg' setWallPaper(paper)
相关文章推荐
- python文件操作
- 《Python核心编程》第五章:数字
- Eclipse和PyDev搭建完美Python开发环境(Windows篇)
- 在eclipse中配置python开发环境
- python远程调试Django程序
- 辛星整理python语言的两个独特之处
- Python类属性和实例属性
- python 收发邮件
- python ConfigParser模块
- Python中的URLLIB及URLLIB2
- Python安装其它库的步骤和问题解决方案汇总
- Python脚本中的#!/usr/bin/python
- 国外少儿PYTHON编程书推荐
- 关于python3.x读取写入文件时编码报错问题
- python常用的特殊属性总结
- 与Python Falling In Love_Python跨台阶(面向对象)
- k-means聚类算法python实践
- python--web.py使用
- python二进制读写文件与普通文件
- 没有return的python,返回为null