0

I'm developing a chromium app running locally using pywebview and cefpython. I've noticed that windows auto scales (125% or 150%) apps on high dpi displays, and following other answers (How do you add a manifest to PyInstaller compiled EXE?) I tried making the app "DPI aware" using a manifest file and Pyinstaller.
Well, nothing changed... (I think I managed to get Pyinstaller working with the manifest file, I can see it with Resource Hacker)

Is this the right direction to avoid my layout to be "zoomed"?
I tried also modifying the High DPI settings in the .exe (right click, properites, compatibility...) with no luck. I wonder if is a Pyinstaller issue...

EDIT: This is my manifest:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
    <assemblyIdentity type="win32" name="D-QSAR" processorArchitecture="amd64" version="1.0.0.0"/>
    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
        <security>
            <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">>
            <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
        </requestedPrivileges>
    </security>
</trustInfo>
<dependency>
    <dependentAssembly>
        <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" language="*" processorArchitecture="*" version="6.0.0.0" publicKeyToken="6595b64144ccf1df"/>
        <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"/>
    </dependentAssembly>
</dependency>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    <application>
        <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
        <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
        <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
        <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
        <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
    </application>
</compatibility>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
    <windowsSettings>
        <longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
    </windowsSettings>
</application>
<asmv3:application>
    <asmv3:windowsSettings>
        <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
        <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
    </asmv3:windowsSettings>
</asmv3:application>
Thomas
  • 185
  • 1
  • 7
  • You may want to see this Microsoft article: [Setting the default DPI awareness for a process](https://learn.microsoft.com/en-us/windows/win32/hidpi/setting-the-default-dpi-awareness-for-a-process). They've changed how things work quite a few times over the years. – Mark Ransom May 31 '21 at 19:59
  • @MarkRansom: I've tried everything at that link. I've tried the programmatic approach with `ctypes.windll.shcore.SetProcessDpiAwareness(2)`. I've tried the manifest approach (the code at that Microsoft link is apparently incomplete since it's missing the UAC request)... I'm wondering if I am totally on a wrong path since nothing is happening. Maybe Pyinstaller wraps the app in some way... – Thomas Jun 01 '21 at 12:53

0 Answers0