[英]How do I stop popup windows in python?
我有一個使用 Pyinstaller 構建的 GUI Pyinstaller
程序。 它使用subprocess
模塊調用其他幾個可執行文件。 每次調用其中一個二進制文件時,與可執行文件關聯的彈出窗口 window 在其執行期間打開。
如何阻止這些彈出?
這是我的電話的樣子:
import subprocess
def run_command(command):
return subprocess.check_output(command, stdin=DEVNULL, stderr=DEVNULL).decode()
CMD_BASE = BLHOST_PATH + " -t 5242000 " + " -u " + " 0x15A2,0x0073 " + " -j "
CMD_RESET = " -- reset"
run_command(CMD_BASE + CMD_RESET))
這是我的 pyinstaller.spec 文件
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(['main.py'],
#TODO: Change the paths here to match your environment
pathex=['c:mypath'],
binaries=[('blhost.exe','tools'),('sdphost.exe','tools'),('ivt_flashloader.bin','tools')],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='Proj',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False , icon='asdf.ico')
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='test')
明白了:NXP-MCUBootUtility exe 是使用 pyinstaller 從 Python 生成的,.spec 文件顯示 Console=True,因此您將始終獲得控制台,除非您自己使用 console=False 重建 exe
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.