setTextAlignment function Qtablewidget PyQt

Zabin zabin.farishta at gmail.com
Mon Jan 11 02:07:10 CET 2010


On Jan 11, 1:10 pm, Zabin <zabin.faris... at gmail.com> wrote:
> Hey!
>
> I am trying to align contents of some table cells but find the code
> below working for some fields and not for others. I am stuck as to why
> this is happening. Help will be gretly appreciated!
>
> setTextAlignment(QtCore.Qt.AlignVCenter)
>
> Cheers
> Zabin

Figured it out!
It was just the '\n' character being read with the line from the text
file that messed up the formatting.
just needed to use the line.strip() function before passing it to the
table as a table widget item.




More information about the Python-list mailing list