HaTiMuX
HaTiMuX

Reputation: 641

Disable or lock text edit PyQT

I want to disable a text edit (when a button is clicked), so the user can no longer be able to add text in there.

Is there any way to do that?

Thanks for your help!!

Upvotes: 10

Views: 22864

Answers (3)

Mr Mike
Mr Mike

Reputation: 333

You can set it as read-only with:

self.textEdit.setReadOnly(True)

I prefer this to the setDisabled method because it maintains its original visual appearance.

Upvotes: 11

Rajiv Sharma
Rajiv Sharma

Reputation: 7102

Use this to disable text edit (QTextEdit) in PyQt

self.textEdit.setDisabled(True)

Upvotes: 8

user3419537
user3419537

Reputation: 5000

Call the text edit object's setDisabled() function

Upvotes: 3

Related Questions