V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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
oldbird
V2EX  ›  Python

bat 运行 Python GUI 程序如何不显示 CMD 窗口

  •  
  •   oldbird · Mar 23, 2020 · 3824 views
    This topic created in 2236 days ago, the information mentioned may be changed or developed.

    做个一个带 GUI 的 python 文件,想通过双击 bat 方式运行该 py 文件启动 GUI,怎么可以不显示黑色的 CMD 窗体?

    4 replies    2020-03-23 23:02:23 +08:00
    linkle
        1
    linkle  
       Mar 23, 2020
    打包 exe 是个不错的选择
    ClericPy
        2
    ClericPy  
       Mar 23, 2020
    扩展名用 .pyw 试过木有?
    imn1
        3
    imn1  
       Mar 23, 2020
    windows 把 .pyw 关联 pythonw.exe ,双击 pyw 就行
    或者做个 lnk
    jworg
        4
    jworg  
       Mar 23, 2020
    除了这上面的,有个笨方法你可以试试,参照实现 wsl 中 Emacs 快捷方式写一个脚本 https://zhuanlan.zhihu.com/p/90173113

    @echo off
    if "%1" == "h" goto begin
    mshta vbscript:createobject("wscript.shell").run("%~nx0 h",0)(window.close)&&exit
    :begin
    python ???????
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1069 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 22:59 · PVG 06:59 · LAX 15:59 · JFK 18:59
    ♥ Do have faith in what you're doing.