[Tutor] pyqt4 set horizontal header item

Phil phil_lor at bigpond.com
Sun Mar 31 06:29:58 CEST 2013


Thank you for reading this.

I want to set a table widget header based on its cell contents.

The following sets all of the headers;

self.tableWidget.setHorizontalHeaderLabels(["One", "Two", "Etc"])

However, self.setHorizontalHeaderItem ( 1, ["test"]) and 
self.setHorizontalHeaderItem ( 1, "test") fail with the following error;

"'MainWindow' object has no attribute 'setHorizontalHeaderItem'"

setHorizontalHeaderItem() exists in the documentation so I must be using 
it incorrectly. I've played with this for quite some time and searched 
the Internet for an answer. Can anyone offer a suggestion?

-- 
Regards,
Phil


More information about the Tutor mailing list