开发者

Displaying other language characters in PyQt

Is there a way to display ot开发者_如何学运维her language characters in PyQt4? and if there is, what's the approach/direction that I should take? Thanks in advance.


Qt uses Unicode and should be able to display (Unicode) text in any language you have a suitable font for. For example, Roberto Alesina's simple "Hello World" program on the PyQt Wiki -- which I transcribe for readability (and w/o the comments for brevity) since it's pretty unreadable in the wiki -- should let you use as the button's text any such Unicode text (so I've taken the liberty of translating it so it uses an accented letter;-)...:

# -*- coding: utf-8 -*-
# (or w/ever other coding you use for unicode literals;-)
import qt, sys
a=qt.QApplication(sys.argv)
w=qt.QPushButton(u"Olá Mundo", None)
w.show()
a.exec_loop()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜