QTableWidget is likely your best choice - it uses .setHorizontalHeaderLabels() and .setVerticalHeaderLabels() to let you control both axes.
from PyQt4 import QtGui
class MyWindow(QtGui.QMainWindow):
def __init__(self, parent):
QtGui.QMainWindow.__init__(self, parent)
table = QtGui.QTableWidget(3, 3, self) # create 3x3 table
table.setHorizontalHeaderLabels(('Col 1', 'Col 2', 'Col 3'))
table.setVerticalHeaderLabels(('Row 1', 'Row 2', 'Row 3'))
for column in range(3):
for row in range(3):
table.setItem(row, column, QtGui.QWidget(self)) # your contents
self.setCentralWidget(table)
self.show()
Of course, if you want full control over the contents and formatting of the headers, then you could use the .setHorizontalHeaderItem() and .setVerticalHeaderItem() methods to define a QTableWidgetItem for each header...
See the official documentation for full details.