[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] QTableWidget: cannot alter text of header labels
From:       Mark Summerfield <list () qtrac ! plus ! com>
Date:       2010-05-21 11:04:34
Message-ID: 201005211204.34980.list () qtrac ! plus ! com
[Download RAW message or body]

On 2010-05-20, Nick Gaens wrote:
> Hello PyQt,
> 
> I'm wondering why I can't change the text that's displayed in the
>  horizontal or vertical header of my standard QTableWidget.
> 
> - Constructor and simple count specification
> 
> self.tw = QtGui.QTableWidget()
> 
> self.tw.setColumnCount(5)
> 
> - Attempt 1:
> > self.tw.setHorizontalHeaderLabels(("a", "b", "c", "d", "e")) # Doesn't
> > work, the default "1" ... "5" are still shown

Try passing a list not a tuple, i.e.,

    self.tw.setHorizontalHeaderLabels(["a", "b", "c", "d", "e"])
    # works for me


-- 
Mark Summerfield, Qtrac Ltd, www.qtrac.eu
    C++, Python, Qt, PyQt - training and consultancy
        "Rapid GUI Programming with Python and Qt" - ISBN 0132354187
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic