Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I'm aware that there are similar problems to mine but I tried those solutions and they don't work.

I have text field:

self.tMail = QtGui.QPlainTextEdit(self.centralwidget)
self.tMail.setGeometry(QtCore.QRect(50, 270, 451, 75))
self.tMail.setAccessibleName(_fromUtf8(""))
self.tMail.setInputMethodHints(QtCore.Qt.ImhNone)
self.tMail.setPlainText(_fromUtf8(""))
self.tMail.setOverwriteMode(False)
self.tMail.setObjectName(_fromUtf8("tMail"))

And i want to add them to the variable string by:

def handleButton(self):
    timeString = self.tCzas.text()
    mailString = self.tMail.text()
    IDString = self.tID.text()
    teamString = self.tTeam.text()
    print(timeString)
    print(mailString)
    print(IDString)
    print(teamString)`

also I tried:

mailString = self.tMail.plainText()

and I always get an error: AttributeError: 'QPlainTextEdit' object has no attribute '...'

QPlainTextEdit doesn't have a text() function. try using the toPlainText() function:

def handleButton(self):
    timeString = self.tCzas.toPlainText()
    mailString = self.tMail.toPlainText()
    IDString = self.tID.toPlainText()
    teamString = self.tTeam.toPlainText()
    print(timeString)
    print(mailString)
    print(IDString)
    print(teamString)
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.