Вот такой вот код для PyQt 4.8, Python 3.1:
from PyQt4 import Qt as qt
import sys
app = qt.QApplication(sys.argv)
mw = qt.QMainWindow()
fr = qt.QFrame()
lt = qt.QVBoxLayout()
btn = qt.QPushButton("green")
tw = qt.QTableWidget()
ti=qt.QTableWidgetItem("Item text")
mw.setCentralWidget(fr)
fr.setLayout(lt)
lt.addWidget(tw)
lt.addWidget(btn)
tw.setRowCount(1)
tw.setColumnCount(1)
tw.setItem(0,0,ti)
def cellchange(row, column):
ti = tw.item(row,column)
ti.setBackground(qt.QBrush(qt.QColor("yellow")))
def changeback(checked):
ti = tw.item(0,0)
ti.setBackground(qt.QBrush(qt.QColor("green")))
tw.cellChanged.connect(cellchange)
btn.clicked.connect(changeback)
mw.show()
app.exec_()
П.С. В доках на сигнал QTableWidget.cellChanged написано так: This signal is emitted whenever the data of the item in the cell specified by row and column has changed.