How do I disable a QLineEdit in Pyqt5?
Example:
inputUserName = QLineEdit(self)
I would like to leave it disabled, same as Html , when we use the disabled attribute. Is it possible?
How do I disable a QLineEdit in Pyqt5?
Example:
inputUserName = QLineEdit(self)
I would like to leave it disabled, same as Html , when we use the disabled attribute. Is it possible?
You can use the setDisabled method of QWidget . QLineEdit inherits from this class.
inputUserName.setDisabled(True)
Complementing the response from LINQ :
You can also use the setEnabled ("enabled"="enabled") method:
inputUserName.setEnabled(False) #desabilita o controle
inputUserName.setEnabled(True) #habilita o controle
Obviously the boolean works in the inverse of setDisabled .