[PyQt] Using Unicode

Gabriel Hahmann gabriel.hahmann at gmail.com
Wed Jun 17 13:53:13 BST 2009


On Wed, Jun 17, 2009 at 12:57 PM, projetmbc<projetmbc at club-internet.fr> wrote:
> 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.
>
>

I'll try this today and then I would let you know the results.

[]'s
Gabriel.



More information about the PyQt mailing list