0

I just prepare something but my code is not working I mean I get a white screen and buttons are not displaying on the page. I thought the problem could be with my computer I'm still using a pc with intel pentium 32 bit but also I could be wrong so my codes are below to post if you could help me I will appreciate that.

import tkinter as tk
from googletrans import Translator

win = tk.Tk()
win.title("My Translator")
win.geometry("200x100")


def translation():

word = entry.get()
translator = Translator(service_urls=['translate.google.com'])
translation1 = translator.translate(word,dest='ru')
label1 = tk.Label(win,text=f"Translated in Russian : {translation1.text}",bg="yellow")
label1.grid(row=2,column=0)
label = tk.Label(win,text="Enter Word :")
label.grid(row=0,column=0,sticky="W")

entry = tk.Entry(win)
entry.grid(row=1,column=0)

button = tk.Button(win,text="Translate",command=translation)
button.grid(row=1,column=2)

win.mainloop()
5
  • Formatting is crucial in python. The code in the question is not properly formatted, hence it does not make sense to talk about it. Please format the code properly. Commented Jan 5, 2020 at 0:50
  • sorry for that I m just new on stackoverflow and programing :) so now its fixed Commented Jan 5, 2020 at 1:18
  • @Melik improve your indentation Commented Jan 5, 2020 at 1:26
  • @eyllanesc Thanks for your comment do you mean you can fix this with indentation? Commented Jan 5, 2020 at 1:36
  • @Melik read docs.python.org/3/reference/lexical_analysis.html#indentation Commented Jan 5, 2020 at 1:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.