[PyQt] DPI scaling on windows

Matic Kukovec kukovecmatic at hotmail.com
Tue Nov 26 11:01:34 GMT 2019


Hi guys,

I'm trying to get a robust way of handling Windows 10 DPI and scaling issues.
If I turn on the PyQt's automatic DPI hangling via:
os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "1"
and:
app.setAttribute(data.Qt.AA_EnableHighDpiScaling)

This works great if the Windows "Scaling" option is set to 100%. Now when the scaling is not 100%,
weird things start happening to the application, like:
icons in labels and buttons look pixelated,
text and cursor in QScintilla editors is displayed incorrectly,
...

But if these PyQt DPI options I mentioned above are not set,
then the application window gets unmanageably big.

Is there a way to either fix the issues described above with the DPI settings, or is there some way to get accurate DPI information when not using PyQt's DPI options (so that the scaling of all widgets could be manually adjusted)?

Thanks,
Matic
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20191126/262bd655/attachment.html>


More information about the PyQt mailing list