from tkinter import *
def a():
b=yjb.get()
if b==3:
label1.config(text="回答正确")
else:
label1.config(text="回答错误")
top=Tk()
top.geometry("300x400")
top.title("单选题")
label1=Label(top,text="余建彬是哪国友人?",bg="pink")
label1.pack()
yjb=IntVar()
radiobutton1=Radiobutton(top,text="阿富汗友人",variable=yjb,value=1,command=a)
radiobutton1.pack()
radiobutton2=Radiobutton(top,text="尼泊尔友人",variable=yjb,value=2,command=a)
radiobutton2.pack()
radiobutton3=Radiobutton(top,text="韩国友人",variable=yjb,value=3,command=a)
radiobutton3.pack()
radiobutton4=Radiobutton(top,text="漂亮国友人",variable=yjb,value=4,command=a)
radiobutton4.pack()
top.mainloop()