【发布时间】:2020-07-10 22:51:34
【问题描述】:
我有 Python 3.7.5 应用程序,其中 wxPython Phoenix GUI 由 PyInstaller 3.6 打包为 .exe。冻结是用这样的参数:
venv\Scripts\pyinstaller app.pyw --clean --onefile --windowed --add-binary icon.ico;. --add-binary logo-iconic.ico;. --add-binary vendor.exe;. --icon logo-iconic.ico --version-file file_version_info.txt
我正在尝试在应用程序窗口中单击按钮时打开链接(例如,https://google.com)而不显示控制台窗口。
我尝试了什么:
wx.LaunchDefaultBrowser('https://google.com')subprocess.Popen('C:\\Windows\\explorer.exe https://google.com')- Recipe 来自 PyInstaller wiki
如果我从 PyInstaller 参数中删除 --windowed,应用程序会按预期使用 wx.LaunchDefaultBrowser('https://google.com'),但控制台窗口会在应用程序启动时显示。如果将 stdout 和 stderr 重定向到 PyInstaller 配方中的文件,我什么也看不到,文件未创建。
如何在 PyInstaller 打包的 Python 应用程序中使用 wxPython GUI 打开默认操作系统浏览器而不出现控制台?
【问题讨论】:
标签: python wxpython pyinstaller