pyqt4 qTableWidget add items help

ookrin ooklah at gmail.com
Sat Apr 18 05:58:42 EDT 2009


I've been searching around the internet for an example of how to add a
list of items to the qTableWidget for the last few hours with little
success.

I have a list orders [[34,940,30,50,67], [50,56,35,30,57]] as my
example here

I built the qTableWidget in designer, so it already has the header
columns filled out.

Date | time | Number | Price | Buyer

ui.tb1_tblOrders.setRowCount(len(orders))

gives me the correct number of rows I want, but how do I fill the
rows?

I've been trying

        while(len(orders)> i):
            ui.tb1_tblOrders.setCurrentCell(i,0,orders[i][1])
            i+=1

which to me, says go add in the first column row with the first order,
and it makes sense to me

 It just says "Error: argument 3 of QTableWidget.setCurrenCell() has
invalid type, I know it's the orders, but I can't figure out what the
proper way of giving it what it wants is.



More information about the Python-list mailing list