V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
ninestep
V2EX  ›  Python

怎么用 Python 改变 windows 壁纸

  •  
  •   ninestep · 2016-04-02 21:42:32 +08:00 · 4961 次点击
    这是一个创建于 2939 天前的主题,其中的信息可能已经有所发展或是发生改变。

    想写一个自动换壁纸的软件自用,下载壁纸已经搞定,但是卡在了换壁纸的哪一步, Google 里面有人用 pywin32 完成了,但是我再 Python3 的环境下没法安装 pywin32 的库,请问给还有什么办法可以完成?

    15 条回复    2016-04-04 11:33:20 +08:00
    loading
        1
    loading  
       2016-04-02 21:58:13 +08:00 via Android   ❤️ 1
    目测有人会趁机吐槽 py3
    zhuangzhuang1988
        2
    zhuangzhuang1988  
       2016-04-02 22:00:05 +08:00
    最简单的, 用 c++写个命令行程序, 然后 python exec 调用就好了。。
    xia0chun
        3
    xia0chun  
       2016-04-02 22:00:29 +08:00
    https://sourceforge.net/projects/pywin32/files/pywin32/Build%20220/
    pywin32 有对应 python3 的安装文件,为什么无法安装?
    daya
        4
    daya  
       2016-04-02 22:05:14 +08:00
    现在壁纸从哪里下载的呢
    manhere
        5
    manhere  
       2016-04-02 22:13:54 +08:00
    reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v Wallpaper /d X:\path\to\wallpaper.jpg /f
    RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters
    leejanfin
        6
    leejanfin  
       2016-04-02 22:13:55 +08:00
    ctypes 模块
    ```
    from ctypes import windll
    windll.user32.SystemParametersInfoA(20, 0, bmpImgPath, 3) # 设置壁纸, 图片格式为 bmp
    ```
    isnowify
        7
    isnowify  
       2016-04-02 22:43:47 +08:00 via iPhone
    @daya bing
    busyluo
        8
    busyluo  
       2016-04-02 22:44:05 +08:00 via iPhone   ❤️ 1
    shew2356
        9
    shew2356  
       2016-04-03 11:48:49 +08:00
    写个 bat , 然后 python 调用
    ivenlee
        10
    ivenlee  
       2016-04-03 16:19:45 +08:00
    ctypes
    ninestep
        11
    ninestep  
    OP
       2016-04-04 11:29:45 +08:00
    @xia0chun 我用的 pip 安装安不上
    ninestep
        12
    ninestep  
    OP
       2016-04-04 11:30:53 +08:00
    @busyluo 感谢,研究研究
    ninestep
        13
    ninestep  
    OP
       2016-04-04 11:31:42 +08:00
    @shew2356 我尝试过,但是网上的命令不能用,我也不太懂 dos ,所以放弃了这条路
    ninestep
        14
    ninestep  
    OP
       2016-04-04 11:32:31 +08:00
    @daya 直接在网上找一个壁纸分享网站,然后爬虫抓取
    ninestep
        15
    ninestep  
    OP
       2016-04-04 11:33:20 +08:00
    @loading 不会吧,现在感觉用 3 的人挺多的额
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1245 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 17:46 · PVG 01:46 · LAX 10:46 · JFK 13:46
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.