【问题标题】:PyQt Dialog Window opened with Pyinstaller executable is 'unfocused'使用 Pyinstaller 可执行文件打开的 PyQt 对话框窗口“未聚焦”
【发布时间】:2019-02-19 14:33:07
【问题描述】:

我有一个奇怪的问题。 我创建了一个 PyQt5 应用程序并使用 Pyinstaller 创建了一个可执行文件。 这是我使用的命令:

pyinstaller nbfixer_decoupled.spec

这是 nbfixer_decoupled.spec 文件:

 -*- mode: python -*-
import sys
block_cipher = None


a = Analysis(['nbfixer_decoupled.py'],
             pathex=['/Users/peterpetocz/Desktop/NBFixer_app'],
             binaries=[],
             datas=[],
             hiddenimports=[],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
             noarchive=False)

a.datas+=[('./login.properties','./login.properties','DATA'),('./status.properties','./status.properties','DATA'),('./signature.properties','./signature.properties','DATA')]

pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)


# Package the executable file into .app if on OS X
if sys.platform == 'darwin':
  exe = EXE(pyz,
            a.scripts,
            a.binaries,
            a.zipfiles,
            a.datas,
            name='NBFixer',
            debug=False,
            strip=False,
            upx=True,
            runtime_tmpdir=None,
            console=True,
            icon='nbfixer.icns')

if sys.platform == 'darwin':
   app = BUNDLE(exe,
                name='NBFixer.app',
                info_plist={
                  'NSHighResolutionCapable': 'True'
                },
                icon='nbfixer.icns')

coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=False,
               upx=True,
               name='nbfixer_decoupled')

/dist 文件夹中的输出是 2 个文件:

一个 unix 可执行文件和一个 .app 可执行文件。

当我启动 unix 可执行文件时,一切都按预期工作。

例如,当我启动 .app 可执行文件时,我无法在输入字段中键入字符。即使我单击输入字段,焦点似乎仍保留在我的文件夹窗口中。

有什么想法吗?

【问题讨论】:

    标签: python pyqt5 pyinstaller


    【解决方案1】:

    原来console=True 的值需要更改为False

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-07-29
      • 1970-01-01
      • 2023-03-30
      • 1970-01-01
      • 1970-01-01
      • 2012-02-21
      • 1970-01-01
      相关资源
      最近更新 更多