将 PyQt4 与 bbfreeze 一起使用 - 使用了错误的 ui 样式 [英] Using PyQt4 with bbfreeze - wrong ui style used

查看:40
本文介绍了将 PyQt4 与 bbfreeze 一起使用 - 使用了错误的 ui 样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以为了提供一些上下文,我的目标是生成一个二进制文件,它可以在任何最近的 linux(但主要是 ubuntu)上运行我的 Python/PyQt4 应用程序,而无需用户安装 pyqt4 或 pyqwt5 库.(如果有人能给出比我下面的方法更好的方法,那也很棒:)

So to give a little context, my goal here is to produce a binary which will run my Python/PyQt4 application on any recent linux (but mainly ubuntu), without requiring the user to install the pyqt4 or pyqwt5 library. (If anyone can give a better way to do that than my method below, that would be great also :)

我主要是通过安装 ubuntu 8.04 虚拟机(来自 bbfreeze 的结果代码不会在安装了较旧 glibc 的系统上运行),在此虚拟机上编译最新版本的 qt、pyqt 等来使用 bbfreeze并冻结应用程序.

I've got this mostly working with bbfreeze by installing an ubuntu 8.04 virtual machine (the resulting code from bbfreeze will not run on a system with an older glibc installation), compiling the latest versions of qt, pyqt etc on this vm and freezing the application on that.

在 ubuntu 8.04 上,运行我的应用程序时,它使用了一种非常古老的风格,而在 ubuntu 10.04 上,它看起来要好得多.

On ubuntu 8.04, when running my application it uses a very old-looking style, where on ubuntu 10.04 it looks much nicer.

这本身不是问题,但问题是当我在 ubuntu 10.04 上运行来自 ubuntu 8.04 的 bbfreezed 代码时,该程序具有与在 8.04 上运行时相同的 UI 样式,这在 10.04 上看起来非常糟糕.

That in itself isn't an issue, but the problem is that when I run the bbfreezed code from ubuntu 8.04 on ubuntu 10.04, the program has the same UI style as when running on 8.04, which looks really bad on 10.04.

所以我想知道,我如何确保我的冻结代码在所有平台上都能正常显示?我认为 bbfreeze 必须只包含 8.04 上使用的 ui 样式,而不是全部,但我不知道如何解决这个问题.

So I'm wondering, how do I make sure that my frozen code will look good on all platforms? I think that bbfreeze must be only including the ui style used on 8.04 rather than all of them, but I'm not sure how to resolve this.

希望这已经足够清楚了!

Hopefully this is clear enough!

推荐答案

我找到了解决方案(我认为,仍在重新编译 qt) - 我只是没有在我的 ubuntu 8.04 上安装 QGtkStyle,因为即使你通过了-gtkstyle 选项 如果您没有安装正确的 gtk+ 开发库,qt 的配置将不会静默编译它.

I found the solution (I think, still recompiling qt) - I just didn't have the QGtkStyle installed on my ubuntu 8.04, since even if you pass the -gtkstyle option qt's configure will silently not compile it if you don't have the correct gtk+ dev libraries installed.

我现在也在使用 pyinstaller 而不是 bbfreeze,但这会对两者产生同等影响.

I'm also using pyinstaller rather than bbfreeze now,but this would have affected both equally.

这篇关于将 PyQt4 与 bbfreeze 一起使用 - 使用了错误的 ui 样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆