[PyKDE] self.trUtf8("<string>")

Christian Bird chris.bird at lineo.com
Wed Jun 19 00:37:01 BST 2002

On Tuesday 18 June 2002 15:33, Karl wrote:
> Hi!
> I have build a project using the Qt Designer for Qt 2.3. When I compile the
> .ui file with pyuic, it uses the function self.trUtf8("<string>") for
> captions of Buttons etc.
> When I want to use the class created, python tells me that there is an
> "attribute error" in all the lines where this Utf8 is used. When i just
> remove the function call and use the string itself, everything works fine.
> But this is of course not a solution as I would have to replace all
> occurances everytime after recompiling the .ui file.
> What's wrong and what can I do?
>   Tnx
>    Karl

try this for foo.ui

pyuic -tr self.tr foo.ui

The tr option tells pyuic to use the following string instead of self.trUtf8.

QObjects and all descendents define a tr function in Qt 2 which is probably 
what you're using if trUtf8 doesn't work.

-- Christian Bird

More information about the PyQt mailing list