I have a server and a client. When the server receives the data, it sends it to the client. Then I need to change the text in the "plain text" element.
class GetCallerThread(QThread):
def __init__(self, mainwindow, parent=None):
super(GetCallerThread, self).__init__(parent)
self.mainwindow = mainwindow
def run(self):
consumer = KafkaConsumer('client', bootstrap_servers=['localhost:29092'])
for message in consumer:
mess = message.value.decode()
self.mainwindow.run_page_plainTextEdit.setPlainText(mess)
self.mainwindow.show()
class Window(QMainWindow, Ui_Application):
tray_icon = None
def __init__(self, parent=None):
super().__init__(parent)
self.setup_ui = self.setupUi(self)
self.center()
self.get_caller_thread_instance = GetCallerThread(mainwindow=self)
self.get_caller_thread_instance.start()
# Init main window
def login_window(self):
dialog = MainWindow(self)
dialog.exec()
class MainWindow(QDialog):
def __init__(self, parent=None):
super().__init__(parent)
loadUi("ui/main_window.ui", self)
if __name__ == "__main__":
app = QApplication(sys.argv)
win = Window()
win.setWindowTitle("App")
win.show()
sys.exit(app.exec())
P.S. This is not the first such problem with stack flow, but I do not know how to fix it. Please, help me.