title: How to setup a pyqt GUI to work on mulitple display sizes and resolutions?
body: <p>I have a pyqt GUI I want to distribute.
  I am working on windows on a full HD display and the current version of my GUI looks fine on my screen.
  But on other screens with a resolution of, for instance 4k, the GUI looks far too small and is barely readable.
  I suppose this is the case because I used <em>fixed</em> coordinates.
  I was thinking about using coordinates relative to the user's display size.
  Imagine I have an approach for this solution like this:</p>
  <pre class="lang-py prettyprint-override"><code>app = QApplication(sys.argv)
  screen = QApplication.instance().primaryScreen().availableGeometry()
  main_window = QMainWindow()
  main_window.setObjectName(u&quot;MainWindow&quot;)
  main_window.show()
  width = screen.width()
  height = screen.height()
  main_window.resize(int(0.2*width),int(0.1*height))
  app.exec()
  </code></pre>
  <p>And for the positioning of the widgets respectively:</p>
  <pre><code>label.setGeometry(QRect(x_pos, y_pos, int(0.2*width),int(0.1*height)))
  </code></pre>
  <p>Is this the right way to do it? Especially I was wondering whether there is something built in in pyqt which I could use for such a common task.
  During my research I found something like:</p>
  <pre><code>QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)
  </code></pre>
  <p>or also something with</p>
  <pre><code>os.environ[&quot;QT_FONT_DPI&quot;] = &quot;96&quot;
  </code></pre>
  <p>But I don't really know how and if I should use something like this at all.</p>
  <p>Is my way the correct approach to this problem or is there a simpler solution?</p>
  <p>Thanks in advance.</p>