python - open PyQt window from thread -
i'am trying python app combine tornado websocket , pyqt windows
need open pyqt window when receive message websocket, program fall down. elegant way how it?
controller:
class mainwindow(qtwidgets.qwidget, widget.ui_form): def __init__(self): super(self.__class__, self).__init__() self.setupui(self) self.message_window = none class message(qtwidgets.qwidget, message.ui_form): def __init__(self, msg): super(self.__class__, self).__init__() self.setupui(self, msg) if __name__ == "__main__": app = qtwidgets.qapplication(sys.argv) window = mainwindow() window.show() s = server(window) s.start() exit(app.exec_())
server:
class server(qtcore.qthread): def __init__(self, main_window): qtcore.qthread.__init__(self) self.msg_win = main_window.message_window def run(self): self.msg_win = controller.message("test") self.msg_win.show() *** starting tornado ***
thanks help
Comments
Post a Comment