Search code examples
pythoninternationalizationpyqt4qtextedithindi

PyQt4: how to add Hindi text to a QTextEdit


How to add Hindi language support while writing text in pyqt?

Here is what I am getting.

Python Console

PyQt4 Window

Please tell me how I can write Hindi language in a PyQt4 window.


Solution

  • The black boxes can mean two things:

    1. The font in the text editor doesn't contain the necessary characters.
    2. You made a mistake when converting the text to a Unicode string.

    Next steps:

    1. Try to copy&paste the text from the console to the editor. If it doesn't, you need a different font. See QtGui.QFont().
    2. If copy&paste works, then you made a mistake when preparing the text. Show us the code if you need further help.