Возникает ошибка:
Traceback (most recent call last):
File "main.py", line 35, in printText
self.textBrowser.append(response)
TypeError: QTextEdit.append(str): argument 1 has unexpected type 'Statement'
Код программы:
import sys
from PyQt5 import QtWidgets
import design # файл дизайна
import os
import re
import datetime
import time
import sys
from pygame import mixer
from gtts import gTTS
from chatterbot.trainers import ListTrainer
from chatterbot import ChatBot
class ExampleApp(QtWidgets.QMainWindow, design.Ui_MainWindow):
def __init__(self):
super().__init__()
self.setupUi(self)
self.pushButton.clicked.connect(self.printText)
def printText(self):
dannie = self.textEdit.toPlainText()
self.textBrowser.append(dannie)
mp3_nameold='111'
mp3_name = "1.mp3"
mixer.init()
bot = ChatBot('Test')
conv = open('chat.txt','r').readlines()
bot.set_trainer(ListTrainer)
bot.train(conv)
while True:
response = bot.get_response(dannie)
str(response)
self.textBrowser.append(response)
def main():
app = QtWidgets.QApplication(sys.argv)
window = ExampleApp()
window.show()
app.exec_()
if __name__ == '__main__':
main()