In tkinter text widget, failed to type in Indian language, rendering shows?

319 Views Asked by At
import tkinter as tk
from tkinter import *

app = tk.Tk()
app.geometry("1000x1000")
app.title("Desktop Translation App")
label1 = tk.Label(app, text="Sentence to Translate")
label1.grid(row=1, column=0)
label2=tk.Label(app,text="Add Translation Here")
label2.grid(row=20,column=0)
entry2=Text(app,width=50 ,background='orange',font = "lucida 13")
entry2.place(x=100, y=115, height=50, width=800)
app.mainloop()

while typing Indian language text in text box, it shows question mark,please help to rectify the issue. so the program should render in Indian language.

Question mark in textbox of tkinter: enter image description here

1

There are 1 best solutions below

1
Alexander Morozov On

Firstly declare your source file encoding:

# -*- coding: utf8 -*-

This must be either the first or second line in the file.

Secondly you need to ensure your editor is actually saving in that encoding