def createTable(self): # Create table self.tableWidget = QTableWidget() self.tableWidget.setRowCount(4) self.tableWidget.setColumnCount(2) self.tableWidget.setItem(0,0, QTableWidgetItem("Cell (1,1)")) self.tableWidget.setItem(0,1, QTableWidgetItem("Cell (1,2)")) self.tableWidget.setItem(1,0, QTableWidgetItem("Cell (2,1)")) self.tableWidget.setItem(1,1, QTableWidgetItem("Cell (2,2)")) self.tableWidget.setItem(2,0, QTableWidgetItem("Cell (3,1)")) self.tableWidget.setItem(2,1, QTableWidgetItem("Cell (3,2)")) self.tableWidget.setItem(3,0, QTableWidgetItem("Cell (4,1)")) self.tableWidget.setItem(3,1, QTableWidgetItem("Cell (4,2)")) self.tableWidget.move(0,0) # table selection change self.tableWidget.doubleClicked.connect(self.on_click) @pyqtSlot() def on_click(self): print("\n") for currentQTableWidgetItem in self.tableWidget.selectedItems(): print(currentQTableWidgetItem.row(), currentQTableWidgetItem.column(), currentQTableWidgetItem.text())
References
https://pythonspot.com/pyqt5-table/