【问题标题】:PyInstaller-packaged PyQt5 app uses wrong style on MacOSPyInstaller 打包的 PyQt5 应用在 MacOS 上使用错误的样式
【发布时间】:2018-07-31 06:26:16
【问题描述】:

我已经使用 PyInstaller for MacOS 打包了一个用 Python 3.6 和 PyQt5 编写的 Python 应用程序。应用程序运行正常,但界面未使用原生样式。手动运行程序确实使用了正确的样式,PyQt.QtWidgets.StyleFactory.keys() 给出了“macintosh”、“Windows”和“Fusion”。运行打包的应用程序时,只有“Windows”和“Fusion”可用。如何将“macintosh”样式与我的应用程序打包并指示 PyQt5 使用本机样式?

【问题讨论】:

  • 我最近遇到了类似的问题。在我的情况下,我在 Windows 上使用该应用程序,当从代码运行时,它正确使用本机样式(称为“windowsvista”样式),但是当使用 pyinstaller 冻结(打包)时,没有可用的“windowsvista”,因此应用程序使用“windows” ' 看起来像 Windows XP 时代之前的风格。到目前为止不知道如何解决这个问题......

标签: python macos pyqt5 pyinstaller


【解决方案1】:

该错误似乎已在 PyInstaller 的未合并分支中修复。更多信息可以在 the GitHub pull request conversation 上找到,但是使用 pip install https://github.com/bjones1/pyinstaller/archive/pyqt5_fix.zip 重新安装 PyInstaller 为我解决了样式问题。

【讨论】:

    猜你喜欢
    • 2018-07-15
    • 2021-07-07
    • 2020-12-03
    • 2019-07-12
    • 1970-01-01
    • 2021-08-07
    • 1970-01-01
    • 1970-01-01
    • 2023-03-06
    相关资源
    最近更新 更多