Important: Please read the Qt Code of Conduct -

Transfer the size of the font in the operating system to the Python Qt program

  • Hi,

    in the Windows operating system, people with a visual impairment can increase the font of the operating system to 125% in "Settings" → "Ease of use" → "Display" in "Increase text". My Python Qt program does not make this change.

    With Java Swing it can be achieved by implementing a certain Java code. With JavaFX the transfer works without extra Java code.

    What do I have to do for such a change to be applied to my Python Qt program?

  • My solution:

    def applicationtypesetting(appv, fontsize):
        font = appv.font()
        font.setPointSize(font.pointSize() * fontsize)
    def main():
        app = QtWidgets.QApplication([])
        win = MainWindow()
        if len(sys.argv) >= 2:
            applicationtypesetting(app, int(sys.argv[1]))
            applicationtypesetting(app, 1);

    If someone has a visual impairment they can call the program as follows:
    python.exe 2

    Question: Do the Python professionals have a better idea?

Log in to reply