【发布时间】:2023-01-26 08:52:26
【问题描述】:
我正在使用 pyinstaller 将我的应用程序捆绑到 Windows(OS) 上,并添加了启动画面选项。加载主窗口并关闭启动画面后,该窗口将停留在背景上(如果您打开了其他窗口,则在其他窗口后面)。 我试过 .raise_() .ActivateWindow() .setVisible(True)。但是他们不会将窗口带到顶部。如果我禁用启动画面,它会正常工作,但我需要启动画面,因为它需要一点时间来加载。 我没有什么可以尝试的了,有人有建议吗?
最低限度是下一个:
'''
Created on Oct 17, 2022
@author: mdelu
'''
import sys
from PyQt5 import QtWidgets
try:
import pyi_splash
except:
pass
# print('Ejecucion en eclipse sin splash')
if __name__ == '__main__':
try:
if (pyi_splash.is_alive()):
pyi_splash.close()
except:
pass
app = QtWidgets.QApplication(sys.argv)
main_window = QtWidgets.QMainWindow()
ui = QtWidgets.QWidget(main_window)
main_window.resize(800, 600)
main_window.show()
sys.exit(app.exec_())
我的 *.spec 文件是:
a = Analysis(['main.py'],
binaries=[],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
noarchive=False,
)
splash_image = 'path'
splash = Splash(splash_image,
binaries=a.binaries,
datas=a.datas,
minify_script=False)
pyz = PYZ(a.pure, a.zipped_data)
exe = EXE(pyz,
splash,
a.scripts,
[],
exclude_binaries=True,
name='main',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=False,
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None)
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
splash.binaries,
strip=False,
upx=True,
upx_exclude=[],
name='exe')
【问题讨论】:
-
感谢您的输入,已经有了,它加载速度更快,因此飞溅的时间少了很多,但它仍然没有弹出
标签: python-3.x pyinstaller splash-screen