class MainListAll(qtw.QMainWindow): def __init__(self): qtw.QMainWindow.__init__(self) self.ui = Ui_listAll() self.ui.setupUi(self) self.show() msg = "listapp" #client.send(bytes(msg,"utf-8")) #data = client.recv(2048) #data = data.decode('utf-8') # Convert decoded data into list #data = eval(data) #chuyển lại thành mảng từ chuỗi đã nhận from server. #num = len(data) #setting Rowcount #set hàng của list show ra #json config f = open('datngu.json',) data = json.load(f) f.close() r = 0 j = 0 temp=[] num = len(data['matches_details']) self.ui.tableScore.setRowCount(num) for i in data['matches_details']: self.ui.tableScore.setItem(r, j, qtw.QTableWidgetItem(i['ID'])) self.ui.tableScore.setItem(r, j+1, qtw.QTableWidgetItem(i['Time'])) self.ui.tableScore.setItem(r, j+2, qtw.QTableWidgetItem(i['Team1'])) self.ui.tableScore.setItem(r, j+3, qtw.QTableWidgetItem(i['Score'])) self.ui.tableScore.setItem(r, j+4, qtw.QTableWidgetItem(i['Team2'])) self.ui.tableScore.setItem(r, j+5, qtw.QTableWidgetItem(i['Yellow cards'])) self.ui.tableScore.setItem(r, j+6, qtw.QTableWidgetItem(i['Red cards'])) self.ui.tableScore.setItem(r, j+7, qtw.QTableWidgetItem(i['Date'])) r += 1 for currentQTableWidgetItem in self.ui.tableScore.selectedItems(): print(currentQTableWidgetItem.row(), currentQTableWidgetItem.column(), currentQTableWidgetItem.text()) #event #SHOW DATA def loadData(self): msg = "listapp" client.send(bytes(msg,"utf-8")) data = client.recv(2048) data = data.decode('utf-8') # Convert decoded data into list data = eval(data) #chuyển lại thành mảng từ chuỗi đã nhận from server. num = len(data) #setting Rowcount self.ui.listView1.setRowCount(num - 2) #set hàng của list show ra #json config f = open('datngu.json',) data = json.load(f) f.close() temp=[] print(data) print("1") for i in data['matches_details']: print(i) #self.ui.listView1.setItem(i,j, qtw.QTableWidgetItem(i[j])) for currentQTableWidgetItem in self.ui.listView1.selectedItems(): print(currentQTableWidgetItem.row(), currentQTableWidgetItem.column(), currentQTableWidgetItem.text()) #DELETE DATA