item = QtWidgets.QTableWidgetItem() item.setText("Hello world") tableWidget.setItem(0, 0, item)
item = QtWidgets.QTableWidgetItem() item.setBackground(QtGui.QColor("#ff0000")) tableWidget.setItem(0, 0, item)In this example, a `QColor` object is created with a hex value, and then set as the background color for a `QTableWidgetItem`. This package is part of the PySide2 library, which is a Python wrapper for the Qt UI framework.