I am trying to display Devanagari (Hindi) text in python3 tkinter. I find that the display of text is incorrect in tkinter for all the widgets capable of holding text. The problem remains for any Truetype font with Unicode support. I have tried "Noto Sans", "Gargi", "Sankrit 2003" and some more Devanagari fonts.
This does not seem to be a problem with the font because -
i) I am getting correct display with any of the above fonts on ubuntu terminal (image attached)
ii) The text display is correct in html
iii) The problem appeared in python fpdf. But it got resolved when the flag set_text_shaping was set to TRUE.
The code is as under :
Any help towards resolving the issue would be thankfully received. If this has already been addressed / discussed in this forum, a link to that topic may please be provided. Thanks in advance.
This does not seem to be a problem with the font because -
i) I am getting correct display with any of the above fonts on ubuntu terminal (image attached)
ii) The text display is correct in html
iii) The problem appeared in python fpdf. But it got resolved when the flag set_text_shaping was set to TRUE.
The code is as under :
from tkinter import * root = Tk() print(TkVersion) T = Text(root, height = 5, width = 52) T.config(font =("Gargi", 20)) l = Label(root, text = "Errors in Devanagari display") l.config(font =("Gargi", 20)) l.pack() T.pack() T.insert(END, " संधिस्थापनके प्रयत्नका औचित्य बताना..") root.mainI have attached images of correct display as well as erroneous display. Correct display is also seen in the code snippet above.
Any help towards resolving the issue would be thankfully received. If this has already been addressed / discussed in this forum, a link to that topic may please be provided. Thanks in advance.
Larz60+ write Nov-25-2024, 03:19 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button. Tags have been added for you this time.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button. Tags have been added for you this time.