"""
姓名 :赵康乐
职业 :学生
日期 :2022-1-21
任务 :设计一个简单的可视化界面
"""
from tkinter import *
def get_answer():
ans1 = answer1.get()
if ans1 != "7":
lable = Label(tk, text="答错了")
lable.grid(row=0, column=2)
else:
lable = Label(tk, text="答对了")
lable.grid(row=0, column=2)
ans2 = answer2.get()
if ans2 != "9":
lable3 = Label(tk, text="答错了")
lable3.grid(row=1, column=2)
else:
lable3 = Label(tk, text="答对了")
lable3.grid(row=1, column=2)
tk = Tk()
tk.geometry("200x100+200+300")
tk.title("一年级数学题")
lable1 = Label(tk, text="3 + 4 =", width=10)
lable1.grid()
lable2 = Label(tk, text="2 +7 =", width=10)
lable2.grid(row=1, column=0)
answer1 = Entry(tk, width=5)
answer1.grid(row=0, column=1)
answer2 = Entry(tk, width=5)
answer2.grid(row=1, column=1)
botton = Button(tk, text="确定", command=get_answer)
botton.grid(row=2, column=1)
tk.mainloop()