Tamil/Indian Languages Support in Tkinter

Eric Brunel see.signature at no.spam
Wed Jun 13 03:21:18 EDT 2007


On Tue, 12 Jun 2007 19:32:38 +0200, reverse_gear <mukundjha at gmail.com>  
wrote:
> hi,
> Does Tkinter has support for tamil/Indian Languages??
> I tried this code
> it is able to print both tamil and german text on console.. but on
> Tkinter Label it is printing only the german code
> Plz help
> from Tkinter import *
> import codecs
>
> german_ae = unicode('\xc3\xa4','utf-8')
> tamil_text = unicode('\xe0\xae\xb9\xe0\xae\xbf \xe0\xae\xae\xe0\xaf
> \x81\xe0\xae\x95\xe0\xaf\x81\xe0\xae\xa9\xe0\xaf\x8d\xe0\xae\x9f
> \xe0\xaf\x8d','utf-8')
> root = Tk()
> print tamil_text
> print german_ae
> label = Label(root, text = german_ae)
> label2= Label(root, text = tamil_text)
> label.pack()
> label2.pack()
> mainloop()

If you have a recent version of tcl/tk, it should work as long as you have  
the proper fonts installed.BTW, I tried it and the tamil text didn't show  
at all on my Linux box: no text on the console (just squares) and nothing  
in the Tkinter label. But I certainly don't have any font able to display  
these characters.

This is apparently not your problem since if it works on the console, you  
should have a usable font. So my guess would be that some font installed  
on your system claims to be able to display these characters, but actually  
isn't. Since you didn't specify a font to use in your labels and the  
default font probably can't display tamil, tk looks for a font that can.  
When it finds one, it stops and uses it. So if a font claims to have these  
characters, but actually can't display them, you end up with a blank text.

Did you try to specify the font to use in the labels? A good candidate  
would obviously be the font used by the console.

And you didn't specify on which platform you were, or your Python and  
tcl/tk version. This may help...

HTH
-- 
python -c "print ''.join([chr(154 - ord(c)) for c in  
'U(17zX(%,5.zmz5(17l8(%,5.Z*(93-965$l7+-'])"



More information about the Python-list mailing list