PySide2 couldn't detect default font

  • Recently I came across this issue, where i guess PySide2 's default settings changed.

    For instance, a normal PySide2 application has bold text and normally there would decent pixel ratio for resized Pixmap and QMovie but now it's very less

    This is the sample Screenshot for the output:

    from PySide2 import QtWidgets  # for right one i used PySide6
    check = QtWidgets.QApplication([])
    _ = QtWidgets.QWidget()
    checking = QtWidgets.QMessageBox.aboutQt(_, "check")


    This affected my project (at a large scale)

    Sorry, I was not able to find the exact technical term for this issue. As I myself find this bizarre since my PySide2 application looked normal yesterday, but right now it looks totally different

    • I tried reinstalling PySide2 Module, it didn't work.
    • I didn't use any StyleSheets or Custom Styles

  • @RahulARanger said in PySide2 default designs were changed:

    For instance, a normal PySide2 application has bold text

    I doubt this is, or ever has been, the case. If your screenshot is supposed to be illustrating this, it does not. The left-hand one is using a larger font than the right-hand one, but not bold.

    I do not claim to know exactly where the change in "default" font size comes from[*]. It could be PySide6, but just as (more?) likely it's Qt6. I don't know whether you could check either PyQt6 or C++ with Qt6 to compare.

    You might like to Google like I did. You don't say what platform you are on. Windows? Is Wrong default GUI font under Windows relevant, which claims

    // Qt 5 by (Qt 4) legacy uses GetStockObject(DEFAULT_GUI_FONT) to

    // obtain the default GUI font (typically "MS Shell Dlg 2, 8pt"). This has been

    // long deprecated; the message font of the NONCLIENTMETRICS structure obtained by

    // SystemParametersInfo(SPI_GETNONCLIENTMETRICS) should be used instead (see

    // QWindowsTheme::refreshFonts(), typically "Segoe UI, 9pt"), which is larger.

    and seems to suggest workarounds (see the comments). too?

  • @JonB thank you for responding.

    I am using Windows10.

    PySide6 was able to detect the exact default Font but PySide2 can't. I did before but suddenly changed, I suspected some changes.

Log in to reply