添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
私奔的火车  ·  Python日常学习 - RioTian ...·  1 周前    · 
星星上的毛豆  ·  Python ...·  5 天前    · 
有腹肌的熊猫  ·  Python ...·  5 天前    · 
不羁的风衣  ·  删除Python launcher - ...·  5 天前    · 
谈吐大方的斑马  ·  OpenLayers 3 之 ...·  1 年前    · 
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.