setTextAlignment function Qtablewidget PyQt

Discussion in 'Python' started by Zabin, Jan 11, 2010.

  1. Zabin

    Zabin Guest

    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
     
    Zabin, Jan 11, 2010
    #1
    1. Advertising

  2. Zabin

    Zabin Guest

    On Jan 11, 1:10 pm, Zabin <> 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.
     
    Zabin, Jan 11, 2010
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ulysses
    Replies:
    4
    Views:
    800
    Werner Schiendl
    Oct 22, 2003
  2. wrightee

    PyQT / QDate / QTableWidget

    wrightee, Mar 26, 2008, in forum: Python
    Replies:
    0
    Views:
    633
    wrightee
    Mar 26, 2008
  3. David Boddie

    Re: PyQT / QDate / QTableWidget

    David Boddie, Mar 28, 2008, in forum: Python
    Replies:
    1
    Views:
    979
    wrightee
    Mar 31, 2008
  4. Constantly Distracted
    Replies:
    3
    Views:
    735
    Constantly Distracted
    Mar 29, 2008
  5. Antonio Valentino

    [PyQt4] QTableWidget non editable

    Antonio Valentino, Jun 22, 2008, in forum: Python
    Replies:
    1
    Views:
    469
    Antonio Valentino
    Jun 22, 2008
Loading...

Share This Page