`hi, How to change row color based on the Yes/No column. I am using sqlite as a database. Below is my code where i want to change color of cells
My PyQt table =====> SQlite Database ===> Expecting result all 1's to green in PyQt5 table widget ====>`
def check_table(self):
try:
cur = self.con.cursor()
cur.execute("SELECT * FROM Curing ORDER BY Time DESC LIMIT 100")
result = cur.fetchall()
col = [i[0] for i in cur.description]
if result:
self.tb_ch_table.setRowCount(len(result))
self.tb_ch_table.setColumnCount(len(col))
self.tb_ch_table.setHorizontalHeaderLabels(col)
# self.tb_ch_table.styleSheet("alternate-background-color: Lightgrey;background-color: white;")
for row, item in enumerate(result):
for column, data in enumerate(item):
self.tb_ch_table.setItem(row, column, QTableWidgetItem(str(data)))
else:
return
QTimer.singleShot(5000, self.check_table)
except Exception as e:
self.frame_ch.setStyleSheet("background-color:rgb(255, 0, 0);")
self.show_ch_msg(msg=str(e))