Important: Please read the Qt Code of Conduct -

AttributeError: type object ‘QPalette’ has no attribute ‘placeholderText’

  • Hello,
    I developed a simple Qt application with graphical user-interface in python(python 3.8.6). I using the following Qt version
    Qt creator 4.13.2
    based on QT 5.15.1 (MSVC 2019, 64bit)
    built on Oct 1 2020 01:14:56
    Now I want to run my application on raspberry pi 3 model B with the Raspberry Pi OS (32-bit) Relased: 2020-08-20.
    I installed on Raspberry board python 3.7.3 using the command:
    sudo apt install python3 idle3
    and the pyqt5 using the command:
    sudo apt-get install python3-pyqt5
    I also updated the all the pakages.
    Then I tried to run the project with Thonny 3.2.6 Linux Python 3.7.3(32 bit) Tk 8.6.9
    But I obtained the following error :
    AttributeError: type object ‘QPalette’ has no attribute ‘placeholderText’
    This error raised from the following python instruction :
    palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.PlaceholderText, brush)

    How I can fix this?
    Thanks in advance for any replies.

  • Lifetime Qt Champion

    @Alessio753 What Qt version do you use? Documentation says: "This function was introduced in Qt 5.12."
    Please note that "Qt creator 4.13.2
    based on QT 5.15.1 (MSVC 2019, 64bit)" does not say which Qt version you're using!

  • @Alessio753
    In addition to needing know what version of Qt you are using as per @jsulm, you also need to supply which version of PyQt you are using, as that will also require to be at >= 5.12 in order to have the binding for the underlying Qt function.

Log in to reply