[PyQt] Newbie Use of QString.rightJustify(6, '0')

Phil Thompson phil at riverbankcomputing.com
Mon Dec 7 22:45:44 GMT 2009


On Mon, 7 Dec 2009 13:38:26 -0800 (PST), rich1939
<r.richardparker at comcast.net> wrote:
> I'm getting text from a QLineEdit control and trying to right-justify it
> with
> zero (0) fill. When I try to say the following:
> 
> text = self.ui.txtNumber.text().rightJustify(6, '0')
> 
> I get an error message saying the argument 2 of the rightJustify call is
an
> invalid type. I have looked at the examples in Riverbank's PyQt Classes
> writeup for that call and it appears that I should be able to call the
> method in the way I am doing.
> 
> Apparently the rightJustify() method needs some other type of fill
> character
> than what I'm trying to provide.
> 
> Please help with this (very small) problem.

As the documentation says, it is expecting a QChar.

Phil


More information about the PyQt mailing list