Tamil/Indian Languages Support in Tkinter

R

reverse_gear

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()

Thanks
 
E

Eric Brunel

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top