user1544500 user1544500 - 18 days ago 5
Python Question

PyInstaller Tkinter window low resolution in App bundle, but not in app program

I think I'm missing something obvious but I can't figure it out myself.

I'm building a Mac App from Python 2.7 using PyInstaller (running the dev3.3 version). The app works fine, no issues. At the beginning there's a small window for updates which is built using Tkinter.

After building the app with PyInstaller (running the oneflie option) I get two files(

ls -al
outcome):

-rwxr-xr-x 1 karoldra staff 62756614 8 lis 11:08 mac
drwxr-xr-x 3 karoldra staff 102 8 lis 11:09 mac.app


Here's the structure of that folder:


  • mac

  • mac.app


    • Contents


      • Frameworks

      • Info.plist

      • MacOs


        • mac


      • Resources


        • MyIcon.icns






Basically - the mac.app package contains exactly the same mac file as the main folder.

The issues is that I get a different resolution in my Tkinter window depending on which file I actually run. Here's a sample of the Tkiter window:


  • the top one is run from the
    mac
    file

  • the bottom one is run from the
    mac.app
    file



enter image description here

As you can see the bottom ones resolution is much lower for some reason...

Can somebody tell me why this is happening and how to solve this issue?

Answer

Eventually I found the answer by...carefully reading the docs ;) There's this one line which solve my problem:

For example, when you use PyQt5, you can set NSHighResolutionCapable to True to let your app also work in retina screen

In case someone else is seeing this problem on MacOs here's the answer:

My spec file was missing the High Resolution setting specified by the info_plist parameter. Here's an example:

app = BUNDLE(exe,
     name='myscript.app',
     icon=None,
     bundle_identifier=None
     info_plist={
        'NSHighResolutionCapable': 'True'
        },
     )

Hope it will help someone else too!!! :)

Comments