class MainChangeMatch(qtw.QMainWindow): def __init__(self): qtw.QMainWindow.__init__(self) self.ui = Ui_ChangeMatch() self.ui.setupUi(self) self.show() self.ui.pushButton.clicked.connect(self.changematch) self.ui.pushButton_2.clicked.connect(exit) def changematch(self): msg = 'ChangeMatch' client.send(bytes(msg, "utf-8")) sleep(0,1) ID=self.ui.lineEdit.text() Score=self.ui.lineEdit_2.text() client.send(bytes(ID, "utf-8")) client.send(bytes(Score, "utf-8")) data = client.recv(BUFSIZ) data = data.decode("utf-8") if data == "Change Match Failed!": print(msg) #do sth elif data == "Change Match Successfully!": print (msg) #do sth