class MainDetails(qtw.QMainWindow): def __init__(self): qtw.QMainWindow.__init__(self) self.ui = Ui_detailMatch() self.ui.setupUi(self) self.show() f=open("PL1.json","r" ) data = json.load(f) f.close() r=0 j=0 a=0 b=0 c=0 x=1 y=2 z=3 num = len(data['Time']) self.ui.tableScore.setRowCount(num) for i in data['Time']: if i =="None": self.ui.tableScore.setItem(r, j, qtw.QTableWidgetItem("")) else: self.ui.tableScore.setItem(r, j, qtw.QTableWidgetItem(i)) r+=1 for i in data['Team1']: if i =="None": self.ui.tableScore.setItem(a, x, qtw.QTableWidgetItem("")) else: self.ui.tableScore.setItem(a, x, qtw.QTableWidgetItem(i)) a+=1 for i in data['Score']: if i =="None": self.ui.tableScore.setItem(b, y, qtw.QTableWidgetItem("")) else: self.ui.tableScore.setItem(b, y, qtw.QTableWidgetItem(i)) b+=1 for i in data['Team2']: if i =="None": self.ui.tableScore.setItem(c, z, qtw.QTableWidgetItem("")) else: self.ui.tableScore.setItem(c, z, qtw.QTableWidgetItem(i)) c+=1 for currentQTableWidgetItem in self.ui.tableScore.selectedItems(): print(currentQTableWidgetItem.row(), currentQTableWidgetItem.column(), currentQTableWidgetItem.text())