I'm using python. There's an entry that with the code entry.get()
I'm going to translate the sentence that the user types.
from googletrans import Translator
from tkinter import *
translator = Translator()
root = Tk()
translator = Translator()
root.resizable(0, 0)
root.geometry('300x200')
l1 = Label(root, text='Text (In any language you want)')
l1.grid(row=1, column=1, padx=10, pady=10)
e1 = Entry(root)
e1.place(x=10, y=30, width=280, height=20)
the_text = e1.get()
translation = translator.translate(the_text, dest='en')
print(translation.text)
mainloop()
And it doesn't work because of:
raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not NoneType
So the error is for the line translation = translator.translate(the_text, dest='en')
I have to tell you that I even tried translation=translator.translate("hermana", dest='en')
as translation = translator.translate(the_text, dest='en')
and it worked. So the problem IS about this that it can not translate the result of the entry...
How can I fix this???