[PyQt] Using Unicode

projetmbc projetmbc at club-internet.fr
Wed Jun 17 11:57:26 BST 2009


projetmbc a écrit :
> dial_project_2 is just my GUI class. For example, the example that I 
> give comes frome something like that
> class dial_Projet2(QtGui.QDialog, Ui_dial_Projet2):
>    ....
>
> Ui_dial_Projet2 is a Python file created from a Dialog built with Qt 
> Designer.
>
> I hope that I'm clear.
>
> Christophe.
>
> PS : Maybe it is possible to subclass the metho tr(). I never try for 
> the moment but it could be an easy way to implement unicode without 
> doing boring changes.
I've just tried the subclass technique and it "seems" to work. So the 
simple thing you have to do is to add the following method in the code 
your pyQtr class :
----------------------------
    def tr(self, text):
        return QtGui.QApplication.translate("putHereTheNameOfYourClass", 
text, None, QtGui.QApplication.UnicodeUTF8)
----------------------------

Christophe.



More information about the PyQt mailing list