(May-20-2022, 08:40 AM)Axel_Erfurt Wrote:(May-19-2022, 11:34 PM)Extra Wrote: Here's the table (called items) that was created:
Ok, that works for me after changing self.tableWidget to self.InventoryDisplay in loaddata
self.tableWidget was never defined
def loaddata(self): connection = sqlite3.connect("inventory.db") cursor = connection.cursor() cursor.execute('select * from items') tablerow=0 results = cursor.fetchall() self.InventoryDisplay.setRowCount(40) for row in results: self.InventoryDisplay.setItem(tablerow, 0, QtWidgets.QTableWidgetItem(row[0])) self.InventoryDisplay.setItem(tablerow, 1, QtWidgets.QTableWidgetItem(row[1])) self.InventoryDisplay.setItem(tablerow, 2, QtWidgets.QTableWidgetItem(row[2])) tablerow+=1 connection.close() #--------------------------------------------------------------------- self.retranslateUi(self) QMetaObject.connectSlotsByName(self)
Thanks, that got my table to display. The only problem is that just the item's name is displayed there is other other information there even through there's supposed to be.
For ex I added the following info to the items table:
NAME MG996R
Quantity 10
Price 5
Sell_Price 6
Description A Servo
Category Servos
Location S-1
Length_Ft
Barcode
Image
Date Updated
But all I get outputted to the table is the item Name:
MG996R
Nothing else.
My question is, why isn't the other info showing?