0
을 '얻을'를이 없습니다 하지만 오류가 나타납니다.AttributeError는 'QTextBrowser'객체는, 내가 입력 할 수 있습니다 다음 <code>textBrowser</code>에 텍스트를 전달할 수있는 <strong>SEND</strong> 버튼을 표시 <code>lineEdit</code>을 가지고 내 UI에 기능을 넣어 노력하고있어 어떤 속성
AttributeError가 : 내가 실수를 한 경우 'QTextBrowser'객체가 내가 잘못 일을 사용했을 수없는 속성 'GET'
from PyQt4 import QtGui
import sys
import design
class ExampleApp(QtGui.QDialog, design.Ui_Dialog):
def __init__(self):
super(self.__class__, self).__init__()
self.setupUi(self)
self.sendButton.clicked.connect(self.send_message)
def send_message(self):
text_contents = self.lineEdit.get()
self.textBrowser.insert(text_contents)
이 없습니다, 정정 해줘. 여기
design.ui : 텍스트를 취득해야하는 경우가 text()
방법을 사용해야하며, textBrowser는 QTextBrowser하고 텍스트를 추가하는 당신이 사용해야합니다
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>441</width>
<height>531</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>441</width>
<height>531</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>441</width>
<height>531</height>
</size>
</property>
<property name="windowTitle">
<string>Chatbot</string>
</property>
<property name="windowIcon">
<iconset>
<normaloff>../python gui/chatbot.png</normaloff>../python gui/chatbot.png</iconset>
</property>
<property name="accessibleName">
<string/>
</property>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>340</x>
<y>450</y>
<width>91</width>
<height>81</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normaloff>../python gui/mic.png</normaloff>../python gui/mic.png</iconset>
</property>
<property name="iconSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoRepeat">
<bool>false</bool>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit">
<property name="geometry">
<rect>
<x>10</x>
<y>450</y>
<width>221</width>
<height>81</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
</widget>
<widget class="QTextBrowser" name="textBrowser">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>441</width>
<height>441</height>
</rect>
</property>
<property name="font">
<font>
<family>MS Shell Dlg 2</family>
<pointsize>16</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
</widget>
<widget class="QPushButton" name="sendButton">
<property name="geometry">
<rect>
<x>240</x>
<y>450</y>
<width>91</width>
<height>81</height>
</rect>
</property>
<property name="font">
<font>
<family>Lucida Console</family>
<pointsize>16</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="statusTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text">
<string>SEND</string>
</property>
<property name="iconSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
는'toPlainText'는 – eyllanesc
@eyllanesc 그 두 가지를 변경하지만 난 오류가 발생했습니다 : 형식 오류를 : QTextEdit.toP lainText() : 인수가 너무 많습니다. – bestnoob
.ui 파일을 표시 할 수 있습니다. – eyllanesc