from tkinter import *
from tkinter import messagebox
import random
result = 0
def start():
global result
numb_1 = random.randint(0,10)
numb_2 = random.randint(0,10)
result = numb_1 * numb_2
label1.config(text=str(numb_1) + " умножить на "+str(numb_2))
def check():
texttoint = int(t1.get())
if result == texttoint:
messagebox.showinfo("сообщение","правильный ответ")
else:
messagebox.showinfo("сообщение","неправильный ответ")
root = Tk()
root.geometry('500x500')
label1 = Label(text=" ", fg="#eee", bg="#333",width=30)
label1.place(x=0,y=0)
start()
t1= Entry()
t1.place(x=0,y=50)
b1 = Button(text="проверить вычисления",command=check)
b1.place(x=0,y=100)
b2 = Button(text="обновить пример",command=start)
b2.place(x=0,y=150)
root.mainloop()
|