aoyilmaz
aoyilmaz

Reputation: 139

How can I get the selected row's value of a qtablewidget in PyQt?

I am working on a small library application. I am getting data from an excel sheet. And then sent to qtablewidget.

  A  B  C
1 a1 b1 c1
2 a2 b2 c2
3 a3 b3 c3

I want to get the selected row values as a list.

row1 = [a1.value, a2.value, a3.value]

How can I do that?

Upvotes: 4

Views: 10469

Answers (1)

aoyilmaz
aoyilmaz

Reputation: 139

I solved myself. Here is the solution:

liste = []
    for i in range(34):
        liste.append(self.ui.tableWidget.item(self.ui.tableWidget.currentRow(), i).text())

    print(liste)

Upvotes: 7

Related Questions