i want to load data into table Widget , this is Ui interface. when i run this code the result is crush , this ui incould function load_data to load data from database file , the name of database fie is abood.db
def load_data(self):
con = sqlite3.connect('abood.db')
query = "SELECT * FROM USERS"
result = con.execute(query)
self.tableWidget.setRowCount(0)
for row_number , row_data in enumerate(result):
self.tableWidget.insertRow(row_number)
for cloum_number , data in enumerate(row_data):
self.tableWidget.SetItem(row_number, cloum_number,
QtWidgets.QTableWidgetItem(str(data)))
How can i solve ? is there error on function load_data
Thanks
如何将QSqlTableModel与QTableView一起使用?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.