[PyKDE] PyQt-x11-gpl-3.4/examples2/widgets.py: buggy or did I mis-install?

Phil Thompson phil at river-bank.demon.co.uk
Sat Nov 9 12:11:00 GMT 2002


On Friday 08 November 2002 9:25 pm, Alex Martelli wrote:
> On Friday 08 November 2002 22:16, Phil Thompson wrote:
>    ...
>
> > > Traceback (most recent call last):
> > >   File "widgets.py", line 480, in lineEditTextChanged
> > >     txt = txt + newText
> > > TypeError: cannot concatenate 'str' and 'instance' objects
> > >
> > >
> > > The other widgets appear to work fine with some cursory testing.
> >
> > It looks like you are running the Qt v2 examples instead of the Qt v3
> > ones.
>
> Silly me, you're right.  However, running example3/widgets.py instead
> STILL shows a traceback whenever I type in the edit-text:
>
> Traceback (most recent call last):
>   File "widgets.py", line 470, in lineEditTextChanged
>     self.msg.setText( "Line edit text: " + newText )
> TypeError: cannot concatenate 'str' and 'instance' objects

It's a simple bug in the example. Change the line to be...

    self.msg.setText( "Line edit text: " + unicode(newText) )

Perhaps I should think about implementing the '+' operator for QStrings.

Phil




More information about the PyQt mailing list