AttributeError: 'QTextEdit' object has no attribute 'text'
时间: 2023-09-20 21:06:22 浏览: 695
python报错: list object has no attribute shape的解决
This error occurs when you try to access the 'text' attribute of a QTextEdit object, which does not exist. QTextEdit is a widget used for displaying and editing plain or formatted text, and it has a 'toPlainText()' method that can be used to retrieve the contents of the widget as a string.
Instead of using 'text', you can use 'toPlainText()' to get the contents of the QTextEdit object. For example:
```
my_text_edit = QTextEdit()
text = my_text_edit.toPlainText()
```
This will retrieve the text in the QTextEdit object and store it in the 'text' variable.
阅读全文