setTextAlignment function Qtablewidget PyQt

Z

Zabin

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
 
Z

Zabin

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top