Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable or lock text edit PyQT

Tags:

python

pyqt

pyqt4

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!!

like image 921
HaTiMuX Avatar asked May 16 '14 13:05

HaTiMuX


3 Answers

Use this to disable text edit (QTextEdit) in PyQt

self.textEdit.setDisabled(True)
like image 96
Rajiv Sharma Avatar answered Oct 21 '22 03:10

Rajiv Sharma


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.

like image 10
Mr Mike Avatar answered Oct 21 '22 04:10

Mr Mike


Call the text edit object's setDisabled() function

like image 3
user3419537 Avatar answered Oct 21 '22 03:10

user3419537