I am writing a program to learn English. The program itself is very simple. The sentences in Russian are displayed alternately and the user must write this sentence in English. I cannot verify the user's input with the value of what is stored in the dictionary. Here is my code:
#-*- coding: utf-8 -*- import random, time from tkinter import * root = Tk() root.title('MyGui') root.geometry('500x500') d = {'собака': 'dog', 'кошка': 'cat', 'стул': 'table'} def foo(*event): s = random.choice(list(d.keys())) lab.config(text=s) data = ent.get() if data == d.get(s): ent.delete(0, END) not_correct.place_forget() else: ent.delete(0, END) not_correct.place(x=250, y=200, anchor='center') not_correct = Label(root, text='No! it is error') lab = Label(root, text='Demo') lab.place(x=250, y=10, anchor='center') ent = Entry(root) ent.place(x=250, y=50, anchor='center') ent.bind('<Return>', foo) but = Button(root, text='Ok') but.place(x=250, y=100, anchor='center') but.bind('<Button-1>', foo) oot.mainloop()