1

I can not write on a standard Georgian language in the Text widget. instead of letters writes question marks . when no tkinter, ie, when writing code, Georgian font recognized without problems. Plus, if I copy the word written in Georgian and inserted in the text widget, it is displayed correctly.

this is elementary code that displays the text box on the screen, where I want to write a word in Georgian.

import tkinter


root = tkinter.Tk()

txt = tkinter.Text(root)
txt.pack()

root.mainloop()

the first image shows how the word is displayed when the selected Georgian language.

the second shot, when I write in the code in Georgian, and define in advance the value of text field. in this case, the text in the field is displayed normally.

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685

2 Answers2

0

Okay, so here is how I achieved it:
First, make sure you have a Georgian font installed in your computer; if there is no any, then go download one (I downloaded mine from here);
Now, go to your tkinter program, and add your font to your Text widget:

txt = tkinter.Text(root, font=("AcadNusx", 16))

NOTE 1: My font name that supports Georgian is AcadNusx, but yours can be different;
NOTE 2: If you have not imported Font, then import it at the beginning of your program;
NOTE 3: Do not change your computer's font to Georgian, because you have already changed it inside the program, so make sure it is set to English.

Parviz Karimli
  • 1,247
  • 1
  • 14
  • 26
  • unfortunately, is not the solution. 'AcadNusx' and other fonts, not the system fonts. they are not included in the installation package of Windows. in Georgia, almost all have forgotten about them, and even in that case it is impossible to enter the same English text. as appropriate, eg. in the case of license plates of cars, etc. I tried this version, and it's easy, but then the program is not that full. I even tried to put the language switch that changes the font of the widget, but in this case change all the text in the widget, which is also not the solution. – giorgi abashidze Sep 18 '16 at 09:17
  • What do you mean by not the system fonts? I have already mentioned that I have downloaded the font from a source and installed it in my computer. Of course, I know that it's not a built-in font installed in Windows OS. But we can install a font that is not in our system yet. – Parviz Karimli Sep 18 '16 at 09:20
  • I wrote the code, that translates the English letters to the Georgian. in widget 'Entry' it works more or less normal, but in the widget 'Text' it is slow and does not have time to translate the characters after me, ie running slow. but still, the script for different widgets written in different ways, as they have different characteristics. but then again, writing a script that takes the Latin characters in Georgian, in fact, not a solution. there must be some way out, may be with the coding, or something else. – giorgi abashidze Sep 18 '16 at 09:20
  • The code that translates the English letters to the Georgian??? WTF! How on Earth can you translate a letter??? Is Georgian and English similar??? Absolutely no! Even the writing systems are totally different. – Parviz Karimli Sep 18 '16 at 09:25
  • in the case of Georgian font('AcadNusx' and others), it is impossible to write in Latin letters, when required. ie write the text, which will be Georgian and Latin characters. and this, as I said, it is very often the case. for example, when you enter the name of the machine, or a model of it, or license plate, which is in Latin, or brand name. – giorgi abashidze Sep 18 '16 at 09:25
  • when you press the key 'a', from Georgian it is 'ა', 'b'-'ბ' and so on. we still so. our alphabet on the keyboard coincides with the Latin alphabet. – giorgi abashidze Sep 18 '16 at 09:29
  • so when I could not find a way to solve the problem, I wrote the code to translate the English letters in the Georgian, in real-time, ie during the typeing on the keyboard .. – giorgi abashidze Sep 18 '16 at 09:32
  • Okay, I think I have started to understand you. You want to see both Georgian and English letters in the text field, right? – Parviz Karimli Sep 18 '16 at 09:55
  • Yes. This is true. I can send you the code that I wrote, and that translates letters into Georgian. :) But this is not a solution to this problems. can you see Georgian characters that I write? - 'ქართული ენა' – giorgi abashidze Sep 18 '16 at 09:59
0

The best answer I can determine so far is that there is something about Georgian and keyboard entry that tk does not like, at least not on Windows.

Character 'translation' is usually called 'transliteration'.

Tk text uses the Basic Multilingual Plane (the BMP, the first 2**16 codepoints) of Unicode. This includes the Georgian alphabet. The second image shows that the default Text widget font on your system is quite capable of displaying Georgian characters once the characters are in the widget. So a new display font does not seem to be the solution to your problem. ('ქართული ენა' is visible on Firefox because FF is unicode based and can display most if not all of the BMP.)

It looks like the problem is getting the proper codes to tk without going through your editor. What OS and editor are your using. How did you enter the mixed-alphabet line similar to

txt.insert('1.0', 'ქართული ენა')  # ?  (I cannot copy the image string.)

How are you running the Python code? If you cut the question marks from the first image and insert into

for c in '<insert here>': print(ord(c))

what do you see?

You need a 'Georgian keyboard entry' or 'input method' program (Google shows several) for your OS that will let you switch back and forth between sending ascii and Geargian codes to any program reading the keyboard.

Windows now comes with this, with languages activated on a case-by-case basis. I already had Spanish entry, and with it I can enter á and ñ both here and into IDLE and a fresh Text box. However, when I add Georgian, I can type (randomly ;-) ჰჯჰფგეუგსკფ here (in FireFox, also MS Edge) but only get ?????? in tk Text boxes. And these are actual ascii question marks, ord('?') = 63, rather that replacements for codes that cannot be represented. Japanese also works with tk-Text based IDLE. So the problem with Georgian is not generic to all non-latin alphabets.

Terry Jan Reedy
  • 18,414
  • 3
  • 40
  • 52