Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyQt font size changes with windows display configurations

Tags:

python

pyqt4

I am working on a PyQt4 GUI. During testing I recognized that the font size of all QLabels changes on diffrent computers. Apprently the windows display configurations can be changed from 100% to 125% or 150%, which then changed the fontsize of my widgets.

Is there an option where I can force the GUI to keep its fontsize independently from the display settings?

Thanks in advance for your help.


Edit:
I seached for the correct terminology, but best I get is this: If you open Control Panel\Appearance and Personalization\Display you can change the font- and other displayed elements-size. This configuration is independent from the screen resolution, but I dont know if it is independent from the actual dpi of the screen. Since AA_DisableHighDpiScaling does not work on PyQt4 I'll have to keep looking for another solution.
like image 793
Simon Avatar asked Aug 16 '17 07:08

Simon


1 Answers

http://doc.qt.io/qt-5/highdpi.html

Looks like you could disable scaling using this snippet (did not check though):

QGuiApplication().setAttribute(Qt.AA_DisableHighDpiScaling)
like image 129
bakatrouble Avatar answered Oct 15 '22 01:10

bakatrouble