Adjust font differences between Qt for Python OS

I would like to request a memorandum and correction. The size of the widget is reproduced in almost the same way on any OS, but the font size is not the same. I wrote the code to adjust the font size between OSs, thinking that it might be related to the difference in DPI.

from PySide2.QtCore import QOperatingSystemVersion
from PySide2 import QtWidgets,QtGui

    currentOsType = QOperatingSystemVersion.currentType()

    if currentOsType == QOperatingSystemVersion.OSType.MacOS:
        font.setPointSize(20)
        return(font)

    if currentOsType == QOperatingSystemVersion.OSType.Windows:
        font.setPointSize(20/1.33333)
    else:
        print(currentOsType)
        font.setPointSize(20/1.33333)

    return(font)

1.3333 is derived from the numbers Mac72dpi and Windows96dpi. This is almost good in my environment, so I haven't investigated further.

Recommended Posts

Adjust font differences between Qt for Python OS
Qt for Python app self-update
Differences between Python, stftime and strptime
Differences between Python, read (), readline (), readlines ()
Differences in authenticity between Python and JavaScript
Differences between Ruby and Python in scope
Differences in syntax between Python and Java
[Basic grammar] Differences between Ruby / Python / PHP
Make Qt for Python app a desktop app
Differences in multithreading between Python and Jython
Differences between Ruby and Python (basic syntax)
Summary of the differences between PHP and Python
2016-10-30 else for Python3> for:
python [for myself]
Python OS operation
My os (python)
[Docker] Adjust container startup timing between dependent services [python]
Building a Python environment for programming beginners (Mac OS)
Differences between numpy and pandas methods for finding variance