How to disable a Qlineedit in Pyqt?

Asked

Viewed 93 times

3

How do I disable one QLineEdit in Pyqt5?

Example:

  inputUserName = QLineEdit(self)

I’d like to disable it, just like in Html, when we use the attribute disabled. It is possible?

2 answers

4

Complementing the response of LINQ:

You can also use the method setEnabled ("enabled" = "enabled"):

inputUserName.setEnabled(False)  #desabilita o controle

inputUserName.setEnabled(True)   #habilita o controle

Obviously the boolean works in the reverse direction of the setDisabled.

2


You can use the method setDisabled of QWidget. QLineEdit inherits from this class.

inputUserName.setDisabled(True)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.