timer = QTimer() timer.timeout.connect(error_task()) timer.setInterval(200) def update(): s.poll() root_window.updateStatus() error = e.poll() print "kinlin" if error: kind, text = error if kind in (linuxcnc.NML_ERROR, linuxcnc.OPERATOR_ERROR): msgBox = QMessageBox().information(self,"ERROR", text) else: msgBox = QMessageBox().information(self,"INFO", text) # QMessageBox.information(self, "INFO", unicode(text)) # showMessage("INFO", unicode(text)) # root_window.after(200, error_task()) #暂时先用 update_ms来更新error信息 update() #timer = QTimer() #timer.timeout.connect(update) #timer.setInterval(200) #timer.setInterval(update_ms) #error_task() root_window.show() app.exec_()