pyqt4 how to know textEdit field is empty

Question:

I want to know if textbox is empty or not. So, I made this code. But, if self.row is ‘ ‘ <- this is not working. Although, textEdit field is empty but, it’s not recognize.

   def setUi(self):
    self.textEdit = QtGui.QTextEdit(MainWindow) 
    self.textEdit.setGeometry(QtCore.QRect(155, 90, 471, 31))
    self.textEdit.setObjectName(_fromUtf8("textEdit"))



   def bringcolumn(self):
    self.row = self.textEdit.toPlainText() 

    if self.row is '': #I want to know if self.row is empty of not.
        QtGui.QMessageBox.information(self, "Message", "ERROR")
Asked By: Layla

||

Answers:

Change if self.row is '' to if str(self.row) == "" ​​

Answered By: Layla
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.