Python 从.app运行时,窗口变得模糊/像素化

Python 从.app运行时,窗口变得模糊/像素化,python,macos,pyqt5,pyinstaller,Python,Macos,Pyqt5,Pyinstaller,我制作了一个小python脚本,它在一个小部件上运行一个时钟,一切正常 我想用它制作一个可执行文件,因此我使用了pyinstaller,从代码的角度来看,一切都可以运行 但是,当我创建一个.app(macOS)(使用-w选项)并使用该应用程序运行脚本时,窗口及其内容的质量会变得更差,就像模糊/像素化一样。奇怪的是,如果我从.app/Contents/MacOS/中取出脚本,并从应用程序外部的文件夹中运行它,质量又恢复正常了 请参见屏幕截图: 正常质量 劣质 有人知道为什么会这样吗?和/或如何

我制作了一个小python脚本,它在一个小部件上运行一个时钟,一切正常

我想用它制作一个可执行文件,因此我使用了pyinstaller,从代码的角度来看,一切都可以运行

但是,当我创建一个.app(macOS)(使用-w选项)并使用该应用程序运行脚本时,窗口及其内容的质量会变得更差,就像模糊/像素化一样。奇怪的是,如果我从.app/Contents/MacOS/中取出脚本,并从应用程序外部的文件夹中运行它,质量又恢复正常了

请参见屏幕截图:

正常质量

劣质


有人知道为什么会这样吗?和/或如何修复

在应用程序的info.plist文件中将“NSHighResolutionCapable”设置为“True”应该可以做到这一点

<plist version="1.0">
<dict>
    <key>CFBundleDisplayName</key>
    <string>port_poirot</string>
    <key>CFBundleExecutable</key>
    <string>MacOS/port_poirot</string>
    <key>CFBundleIconFile</key>
    <string>detective.icns</string>
    <key>CFBundleIdentifier</key>
    <string>port_poirot</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>port_poirot</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>0.0.0</string>
    <key>NSHighResolutionCapable</key>
    <string>True</string>
</dict>
</plist>

CbundleDisplayName
波洛港
Cbundlexecutable
马科斯/波洛港
循环流化床锅炉
艾克斯侦探
CbundleIdentifier
波洛港
CbundleInfo字典版本
6
CFBundleName
波洛港
CbundlePackageType
应用
CbundleShortVersionString
0.0.0
NShighResolutionable
真的
修改pyinstaller的spec文件使其变得更容易。

我一定要试试!谢谢你的回答