Tamil/Indian Languages Support in Tkinter

Discussion in 'Python' started by reverse_gear, Jun 12, 2007.

  1. reverse_gear

    reverse_gear Guest

    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
    reverse_gear, Jun 12, 2007
    #1
    1. Advertising

  2. reverse_gear

    Eric Brunel Guest

    On Tue, 12 Jun 2007 19:32:38 +0200, reverse_gear <>
    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+-'])"
    Eric Brunel, Jun 13, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex Varghese
    Replies:
    5
    Views:
    419
  2. pallavi
    Replies:
    11
    Views:
    567
  3. dot
    Replies:
    0
    Views:
    412
  4. Alex Varghese
    Replies:
    1
    Views:
    300
    Victor Bazarov
    Oct 10, 2003
  5. Replies:
    0
    Views:
    227
Loading...

Share This Page