Python Forum
Unable to display Devanagari ligatures correctly in python tkinter
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to display Devanagari ligatures correctly in python tkinter
#1
Smile 
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 :

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.main
I 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.
Reply


Messages In This Thread
Unable to display Devanagari ligatures correctly in python tkinter - by Anamika - Nov-24-2024, 08:47 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to display results from terminal window onto tkinter. buttercup 0 4,465 Jul-21-2020, 04:41 AM
Last Post: buttercup
  [Tkinter] How to compare two variables correctly in tkinter scratchmyhead 2 4,790 May-10-2020, 08:04 PM
Last Post: scratchmyhead
  [Tkinter] Problems to display Web Scraping values in Tkinter Lucas_Ribeiro 0 2,054 May-07-2020, 12:36 AM
Last Post: Lucas_Ribeiro
  Tkinter:Unable to bind and unbind function with a button shallanq 2 6,146 Mar-28-2020, 02:05 AM
Last Post: joe_momma
  Unable fetch fucntion data in class in tkinter jenkins43 2 4,959 Nov-30-2019, 09:47 PM
Last Post: jenkins43
  Unable to put background image on Tkinter Frame jenkins43 2 9,812 Nov-27-2019, 11:38 AM
Last Post: jenkins43
  tkInter and Pillow don't display any images in GUIs - program gives errors instead SomeRandomGuy 9 17,338 Oct-29-2019, 02:57 PM
Last Post: SomeRandomGuy
  Unable to update or refresh label text in tkinter jenkins43 3 8,732 Jul-24-2019, 02:09 PM
Last Post: Friend
  Display and update the label text which display the serial value jenkins43 5 11,118 Feb-04-2019, 04:36 AM
Last Post: Larz60+
  Display more than one button in GUI to display MPU6000 Sensor readings barry76 4 5,136 Jan-05-2019, 01:48 PM
Last Post: wuf

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020