Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Transfer the size of the font in the operating system to the Python Qt program
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 1 Posters 170 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    PythonQTMarlem
    wrote on last edited by
    #1

    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.

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

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

    1 Reply Last reply
    0
    • P Offline
      P Offline
      PythonQTMarlem
      wrote on last edited by PythonQTMarlem
      #2

      My solution:

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

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

      Question: Do the Python professionals have a better idea?

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved