mapping letters to pictures in Tkinter mapping letters to pictures in Tkinter tkinter tkinter

mapping letters to pictures in Tkinter


The upper/lowercase glagoljica alphabet occupies unicode block U+2C00–U+2C5F, with U+2C2F and U+2C5F undefined. Tkinter can handle and, depending on your system and the font you use, display the characters. PIL should not be needed.

If you use a dict, it should map slavic chars to glagoljica chars.

glag = {'\u0410':'\u2C00', '\u0410':'\u2c01',}  # etcprint('\u0410', glag['\u0410'])# ('А', 'Ⰱ')

I am using 3.4.2 on Win7 with Lucida Console.

However, instead of an explicit loop, string translation should use str.translate and a table from str.maketrans.

trans1 = str.maketrans(glag)print('ААБАБ'.translate(trans1))#'ⰁⰁБⰁБ'

With this, a dict object is not needed.

trans2 = str.maketrans('АБ', 'ⰁБ')  # could enter with \u excapesprint('ААБАБ'.translate(trans1))#'ⰁⰁБⰁБ'