【问题标题】:cxfreeze produces fuzzy gui on macbook pro with retina displaycx_freeze 在带有视网膜显示的 macbook pro 上生成模糊 gui
【发布时间】:2014-11-13 02:37:29
【问题描述】:

我正在一个带有视网膜显示屏的 macbook pro 上构建一个 pyside 应用程序,这是我的设置文件:

import sys
from cx_Freeze import setup, Executable

# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os", "sys", "PySide", "datetime", "subprocess"], "excludes": ["tkinter"]}

# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
    base = "Win32GUI"


options = {
    'build_exe': {
        'includes': 'atexit'
    }
}

executables = [
    Executable('countdown.py', base=base)
]

setup(  name = "Countdown",
        version = "0.1",
        description = "Countdown timer",
        options = options,
        executables = executables)

然后我构建了我的应用程序:

python3.3 setup.py bdist_mac

countdown_0.1.app 运行正常,只是 gui 有点模糊:

与直接执行 countdown.py 相比:

我想知道为什么它们看起来如此不同?

【问题讨论】:

  • 这很奇怪。应用程序包中必须有一些元数据来控制它。

标签: python macos qt pyside cx-freeze


【解决方案1】:

cx_Freeze 生成的包在其 Info.plist 文件中缺少布尔条目 NSHighResolutionCapable[1],因此应用程序以“放大”模式运行。

将现有的 Info.plist(在您的情况下为Countdown-0.1.app/Contents/Info.plist)复制到您的 setup.py 所在的目录。在本例中,修改后的 Info.plist 将命名为 Info-highres.plist

使用文本编辑器打开 Info-highres.plist 并将此条目添加到字典中:

<key>NSHighResolutionCapable</key>
<true/>

或者,如果您愿意,可以使用 Xcode plist 编辑器添加条目。

使用下面的设置命令,默认的 Info.plist 将被修改后的 Info-highres.plist 替换,您的应用将“支持视网膜”。

python setup.py bdist_mac --custom-info-plist Info-highres.plist

您还可以将custom_info_plist 指令插入到您的 setup.py 脚本中。见http://cx-freeze.readthedocs.org/en/latest/distutils.html#bdist-mac

[1]https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html(图1-8)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-12-19
    • 1970-01-01
    • 1970-01-01
    • 2013-01-24
    • 2017-06-05
    • 2015-07-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多