Blurred GUI after PyInstaller compilation

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Blurred GUI after PyInstaller compilation

mar...@frightanic.com
For a GUI application built with wxPython I noticed the GUI becomes all blurry after it is compiled into a binary with PyInstaller. Tried both 3.6 and 4.2 but the effect is largely the same.
Build environement: macOS Big Sur, same with previous versions

Has one of you seen a similar behavior and/or an idea how to fix this?

Running Python app
Screen Shot 2021-02-01 at 22.56.33.png

➜  NodeMCU-PyFlasher git:(master) ✗ python3 --version
Python 3.8.2

Running the binary
Screen Shot 2021-02-01 at 22.57.15.png

Thanks

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/f7692bea-1002-4523-8946-4933116f1bd3n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Blurred GUI after PyInstaller compilation

Jesse Hopkins
I came here searching for a different wxpython issue, but suspect I know the problem here, as I ran into it a while back. You should set the NSHighResolutionCapable flag in your info.plist file. You can do this in the BUNDLE method using the info_plist command, or manually set it. Here's an example from a program I maintain (where coll is the output of the COLLECT):

if opsys == 'Darwin':
    app = BUNDLE(
        coll,
        name='RAW.app',
        icon=raw_icon,
        bundle_identifier='edu.bioxtas.raw',
        info_plist=
            {
            'CFBundleVersion' : RAWGlobals.version,
            'CFBundleShortVersionString' : RAWGlobals.version,
            'LSBackgroundOnly' : '0',
            'NSHighResolutionCapable' : True,
            'NSPrincipleClass' : 'NSApplication',
            'CFBundleDevelopmentRegion' : 'en_US',
            'LSHasLocalizedDisplayName' : False,
            'CFBundleDocumentTypes' : [
                {
                    'CFBundleTypeName' : 'SAXS data file',
                    'LSHandlerRank' : 'Default',
                    'CFBundleTypeExtensions': ['out', 'fit', 'fir', 'rad',
                        'int', 'dat', 'csv', 'sub', 'txt'],
                    'CFBundleTypeRole' : 'Viewer'
                },
                {
                    'CFBundleTypeName' : 'Image file',
                    'LSHandlerRank' : 'Default',
                    'CFBundleTypeExtensions': ['tif', 'tiff', 'nxs', 'edf',
                        'ccdraw', 'img', 'imx_0', 'dkx_0', 'dxk_1', 'png',
                        'mpa', 'mar1200', 'mar2400', 'mar3200', 'mar3600',
                        'sfrm', 'dm3', 'xml', 'cbf', 'kccd', 'msk',
                        'spr', 'h5', 'mccd', 'mar3450', 'npy', 'No'],
                    'CFBundleTypeRole' : 'Viewer'
                },
                {
                    'CFBundleTypeName' : 'LC data file',
                    'LSHandlerRank' : 'Default',
                    'CFBundleTypeExtensions': ['sec',],
                    'CFBundleTypeRole' : 'Viewer'
                },
            ],
            },
        )

If it's already installed and you overwrite the .app, you might have to force MacOS to update the changes, this set of commands should do it:
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f /Applications/<my_app>.app /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -seed /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f /Applications -all local,user

You may then have to right click on the .app, select ‘Get Info’ and uncheck the box ‘Open in low resolution mode’.

Hope that helps.

- Jesse

On Tuesday, February 2, 2021 at 10:42:47 AM UTC-6 [hidden email] wrote:
For a GUI application built with wxPython I noticed the GUI becomes all blurry after it is compiled into a binary with PyInstaller. Tried both 3.6 and 4.2 but the effect is largely the same.
Build environement: macOS Big Sur, same with previous versions

Has one of you seen a similar behavior and/or an idea how to fix this?

Running Python app
Screen Shot 2021-02-01 at 22.56.33.png

➜  NodeMCU-PyFlasher git:(master) ✗ python3 --version
Python 3.8.2

Running the binary
Screen Shot 2021-02-01 at 22.57.15.png

Thanks

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/6f3ae96b-4b01-4c91-ab0d-a3fdd570f732n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Blurred GUI after PyInstaller compilation

mar...@frightanic.com
Thanks! That build config looks quite a bit more involved than the spec I use :) https://github.com/marcelstoer/nodemcu-pyflasher/blob/master/build-on-mac.spec

On Thursday, April 8, 2021 at 9:46:12 AM UTC+2 Jesse Hopkins wrote:
I came here searching for a different wxpython issue, but suspect I know the problem here, as I ran into it a while back. You should set the NSHighResolutionCapable flag in your info.plist file. You can do this in the BUNDLE method using the info_plist command, or manually set it. Here's an example from a program I maintain (where coll is the output of the COLLECT):

if opsys == 'Darwin':
    app = BUNDLE(
        coll,
        name='RAW.app',
        icon=raw_icon,
        bundle_identifier='edu.bioxtas.raw',
        info_plist=
            {
            'CFBundleVersion' : RAWGlobals.version,
            'CFBundleShortVersionString' : RAWGlobals.version,
            'LSBackgroundOnly' : '0',
            'NSHighResolutionCapable' : True,
            'NSPrincipleClass' : 'NSApplication',
            'CFBundleDevelopmentRegion' : 'en_US',
            'LSHasLocalizedDisplayName' : False,
            'CFBundleDocumentTypes' : [
                {
                    'CFBundleTypeName' : 'SAXS data file',
                    'LSHandlerRank' : 'Default',
                    'CFBundleTypeExtensions': ['out', 'fit', 'fir', 'rad',
                        'int', 'dat', 'csv', 'sub', 'txt'],
                    'CFBundleTypeRole' : 'Viewer'
                },
                {
                    'CFBundleTypeName' : 'Image file',
                    'LSHandlerRank' : 'Default',
                    'CFBundleTypeExtensions': ['tif', 'tiff', 'nxs', 'edf',
                        'ccdraw', 'img', 'imx_0', 'dkx_0', 'dxk_1', 'png',
                        'mpa', 'mar1200', 'mar2400', 'mar3200', 'mar3600',
                        'sfrm', 'dm3', 'xml', 'cbf', 'kccd', 'msk',
                        'spr', 'h5', 'mccd', 'mar3450', 'npy', 'No'],
                    'CFBundleTypeRole' : 'Viewer'
                },
                {
                    'CFBundleTypeName' : 'LC data file',
                    'LSHandlerRank' : 'Default',
                    'CFBundleTypeExtensions': ['sec',],
                    'CFBundleTypeRole' : 'Viewer'
                },
            ],
            },
        )

If it's already installed and you overwrite the .app, you might have to force MacOS to update the changes, this set of commands should do it:
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f /Applications/<my_app>.app /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -seed /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f /Applications -all local,user

You may then have to right click on the .app, select ‘Get Info’ and uncheck the box ‘Open in low resolution mode’.

Hope that helps.

- Jesse

On Tuesday, February 2, 2021 at 10:42:47 AM UTC-6 [hidden email] wrote:
For a GUI application built with wxPython I noticed the GUI becomes all blurry after it is compiled into a binary with PyInstaller. Tried both 3.6 and 4.2 but the effect is largely the same.
Build environement: macOS Big Sur, same with previous versions

Has one of you seen a similar behavior and/or an idea how to fix this?

Running Python app
Screen Shot 2021-02-01 at 22.56.33.png

➜  NodeMCU-PyFlasher git:(master) ✗ python3 --version
Python 3.8.2

Running the binary
Screen Shot 2021-02-01 at 22.57.15.png

Thanks

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/e22f946a-ac97-4256-b419-e608c71eec50n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Blurred GUI after PyInstaller compilation

Jesse Hopkins
The full build config is even worse, because it handles windows and linux as well, and includes various resource files :) https://sourceforge.net/p/bioxtasraw/git/ci/master/tree/installer/RAW.spec

If you want a minimal info_plist definition, basically duplicate mine but remove the CFBundleDocumentTypes definition. It's useful to have some info_plist stuff because it defines not just the high resolution capabilities but also gives it a version that display in finder, which is useful. You can also edit the info.plist manually in your .app if you'd like, using either a text editor or XCode.

- Jesse

On Thursday, April 8, 2021 at 1:21:04 PM UTC-5 [hidden email] wrote:
Thanks! That build config looks quite a bit more involved than the spec I use :) https://github.com/marcelstoer/nodemcu-pyflasher/blob/master/build-on-mac.spec

On Thursday, April 8, 2021 at 9:46:12 AM UTC+2 Jesse Hopkins wrote:
I came here searching for a different wxpython issue, but suspect I know the problem here, as I ran into it a while back. You should set the NSHighResolutionCapable flag in your info.plist file. You can do this in the BUNDLE method using the info_plist command, or manually set it. Here's an example from a program I maintain (where coll is the output of the COLLECT):

if opsys == 'Darwin':
    app = BUNDLE(
        coll,
        name='RAW.app',
        icon=raw_icon,
        bundle_identifier='edu.bioxtas.raw',
        info_plist=
            {
            'CFBundleVersion' : RAWGlobals.version,
            'CFBundleShortVersionString' : RAWGlobals.version,
            'LSBackgroundOnly' : '0',
            'NSHighResolutionCapable' : True,
            'NSPrincipleClass' : 'NSApplication',
            'CFBundleDevelopmentRegion' : 'en_US',
            'LSHasLocalizedDisplayName' : False,
            'CFBundleDocumentTypes' : [
                {
                    'CFBundleTypeName' : 'SAXS data file',
                    'LSHandlerRank' : 'Default',
                    'CFBundleTypeExtensions': ['out', 'fit', 'fir', 'rad',
                        'int', 'dat', 'csv', 'sub', 'txt'],
                    'CFBundleTypeRole' : 'Viewer'
                },
                {
                    'CFBundleTypeName' : 'Image file',
                    'LSHandlerRank' : 'Default',
                    'CFBundleTypeExtensions': ['tif', 'tiff', 'nxs', 'edf',
                        'ccdraw', 'img', 'imx_0', 'dkx_0', 'dxk_1', 'png',
                        'mpa', 'mar1200', 'mar2400', 'mar3200', 'mar3600',
                        'sfrm', 'dm3', 'xml', 'cbf', 'kccd', 'msk',
                        'spr', 'h5', 'mccd', 'mar3450', 'npy', 'No'],
                    'CFBundleTypeRole' : 'Viewer'
                },
                {
                    'CFBundleTypeName' : 'LC data file',
                    'LSHandlerRank' : 'Default',
                    'CFBundleTypeExtensions': ['sec',],
                    'CFBundleTypeRole' : 'Viewer'
                },
            ],
            },
        )

If it's already installed and you overwrite the .app, you might have to force MacOS to update the changes, this set of commands should do it:
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f /Applications/<my_app>.app /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -seed /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f /Applications -all local,user

You may then have to right click on the .app, select ‘Get Info’ and uncheck the box ‘Open in low resolution mode’.

Hope that helps.

- Jesse

On Tuesday, February 2, 2021 at 10:42:47 AM UTC-6 [hidden email] wrote:
For a GUI application built with wxPython I noticed the GUI becomes all blurry after it is compiled into a binary with PyInstaller. Tried both 3.6 and 4.2 but the effect is largely the same.
Build environement: macOS Big Sur, same with previous versions

Has one of you seen a similar behavior and/or an idea how to fix this?

Running Python app
Screen Shot 2021-02-01 at 22.56.33.png

➜  NodeMCU-PyFlasher git:(master) ✗ python3 --version
Python 3.8.2

Running the binary
Screen Shot 2021-02-01 at 22.57.15.png

Thanks

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/6951aaec-95be-452b-95f3-f0ab50d12bdbn%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Blurred GUI after PyInstaller compilation

mar...@frightanic.com
In reply to this post by mar...@frightanic.com
Btw thanks to https://github.com/pyinstaller/pyinstaller/pull/5230 NSHighResolutionCapable is enabled by default.

On Thursday, April 8, 2021 at 8:21:04 PM UTC+2 [hidden email] wrote:
Thanks! That build config looks quite a bit more involved than the spec I use :) https://github.com/marcelstoer/nodemcu-pyflasher/blob/master/build-on-mac.spec

On Thursday, April 8, 2021 at 9:46:12 AM UTC+2 Jesse Hopkins wrote:
I came here searching for a different wxpython issue, but suspect I know the problem here, as I ran into it a while back. You should set the NSHighResolutionCapable flag in your info.plist file. You can do this in the BUNDLE method using the info_plist command, or manually set it. Here's an example from a program I maintain (where coll is the output of the COLLECT):

if opsys == 'Darwin':
    app = BUNDLE(
        coll,
        name='RAW.app',
        icon=raw_icon,
        bundle_identifier='edu.bioxtas.raw',
        info_plist=
            {
            'CFBundleVersion' : RAWGlobals.version,
            'CFBundleShortVersionString' : RAWGlobals.version,
            'LSBackgroundOnly' : '0',
            'NSHighResolutionCapable' : True,
            'NSPrincipleClass' : 'NSApplication',
            'CFBundleDevelopmentRegion' : 'en_US',
            'LSHasLocalizedDisplayName' : False,
            'CFBundleDocumentTypes' : [
                {
                    'CFBundleTypeName' : 'SAXS data file',
                    'LSHandlerRank' : 'Default',
                    'CFBundleTypeExtensions': ['out', 'fit', 'fir', 'rad',
                        'int', 'dat', 'csv', 'sub', 'txt'],
                    'CFBundleTypeRole' : 'Viewer'
                },
                {
                    'CFBundleTypeName' : 'Image file',
                    'LSHandlerRank' : 'Default',
                    'CFBundleTypeExtensions': ['tif', 'tiff', 'nxs', 'edf',
                        'ccdraw', 'img', 'imx_0', 'dkx_0', 'dxk_1', 'png',
                        'mpa', 'mar1200', 'mar2400', 'mar3200', 'mar3600',
                        'sfrm', 'dm3', 'xml', 'cbf', 'kccd', 'msk',
                        'spr', 'h5', 'mccd', 'mar3450', 'npy', 'No'],
                    'CFBundleTypeRole' : 'Viewer'
                },
                {
                    'CFBundleTypeName' : 'LC data file',
                    'LSHandlerRank' : 'Default',
                    'CFBundleTypeExtensions': ['sec',],
                    'CFBundleTypeRole' : 'Viewer'
                },
            ],
            },
        )

If it's already installed and you overwrite the .app, you might have to force MacOS to update the changes, this set of commands should do it:
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f /Applications/<my_app>.app /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -seed /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f /Applications -all local,user

You may then have to right click on the .app, select ‘Get Info’ and uncheck the box ‘Open in low resolution mode’.

Hope that helps.

- Jesse

On Tuesday, February 2, 2021 at 10:42:47 AM UTC-6 [hidden email] wrote:
For a GUI application built with wxPython I noticed the GUI becomes all blurry after it is compiled into a binary with PyInstaller. Tried both 3.6 and 4.2 but the effect is largely the same.
Build environement: macOS Big Sur, same with previous versions

Has one of you seen a similar behavior and/or an idea how to fix this?

Running Python app
Screen Shot 2021-02-01 at 22.56.33.png

➜  NodeMCU-PyFlasher git:(master) ✗ python3 --version
Python 3.8.2

Running the binary
Screen Shot 2021-02-01 at 22.57.15.png

Thanks

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/cadc2916-3c0e-4786-8d9e-2217f8200c77n%40googlegroups.com.