Tkinter and Greek Symbols

Martin v. Loewis martin at v.loewis.de
Fri Feb 15 16:22:36 EST 2002


Дамјан Г.  <пенгуиниста@маил.нет.мк> writes:

> > If you happen to know that GREEK SMALL LETTER ALPHA is \u0391, you can
> > use that as well. If you have an editor that supports utf-8, you can
> > use unicode("<utf-8 encoding of the greek text>", "utf-8") instead
> > of the Unicode literal.
> 
> Does this mean that Tkinter support unicode?

It certainly does. Starting with 8.0, Tcl recognizes UTF-8 internally,
and provides a rich character set conversion library; with 8.1 and
later, it also offers a Unicode type internally.

Tkinter integrates the Tk Unicode support since Python 2.0.

> Does it support the iso10646-1 fonts too?

Tk uses the system fonts; it does not come with fonts on its own. It
can display Unicode strings even if the fonts are not Unicode encoded,
since it knows how to convert Unicode into the font's encoding.

> Can I display Symbols from several alphabets n a single widget?

Certainly. Tk is quite smart in selecting fonts; it tries to use the
same font as long as possible, and then switches to a different font
where necessary.

> And how do I get the keyboard input, in unicode od locale specific?

In Unicode. Actually, Tkinter, when retrieving a string from Tcl,
returns it as a byte string if it is all ASCII, and as a Unicode
string otherwise.

HTH,
Martin



More information about the Python-list mailing list