0

Currently I have this code:

self.tblDinamic = QTableWidget()
self.tblDinamic.setFont(font)

And I want to set/change the default blank/white color of these background. I don't know if I can change it in general (in the own QTableWidget() ) or I should change it in his QTableWidgetItem(). But if I can, I prefer change it on QTableWidget()

Anyone could help me? Thank you!

Jordi Vicens
  • 696
  • 7
  • 17

1 Answers1

0

I recently had the same question, I have found the answer :

as said here :

You must first create an item in that place in the table before you can set its background color.

self.tableWidget.setItem(3, 5, QtGui.QTableWidgetItem())
self.tableWidget.item(3, 5).setBackground(QtGui.QColor(100,100,150))

other good example using image

Vaibhav Mule
  • 5,016
  • 4
  • 35
  • 52
Dadep
  • 2,796
  • 5
  • 27
  • 40