Mundo em Python

Pergunta usando Radiobutton (usando tkinter )

from tkinter import *
def selecionar():
o =opcao.get()
if o=="1" or o=="2" or o=="3":
t = "Resposta Errada"
monitor.config(text="{}".format(t))
else:
t = "Resposta Correcta"
monitor.config(text="{}".format(t)) def reset():
opcao.set(None)
monitor.config(text="")
root = Tk()
root.geometry("400x250")
root.resizable(0, 0)
root.title("Pergunta usando Radiobutton ")
root.config(bg="#d9ead3")
opcao = StringVar()
pergunta = Label(text="Quanto é 2+2? ",
font=("Arial","15","bold"),fg="#bf9000",bg="#d9ead3")
pergunta.place(relx=0.33,rely=0.05)
a=Radiobutton(root, text="A-4", variable=opcao,
value=5, command=selecionar
,bg="#d9ead3",fg="#3174a7",font=("Arial","12","bold"))
a.place(relx=0.45, rely=0.2)
b=Radiobutton(root, text="B-5", variable=opcao,
value=1, command=selecionar,
bg="#d9ead3",fg="#3174a7",font=("Arial","12","bold"))
b.place(relx=0.45, rely=0.3)
c=Radiobutton(root, text="C-6", variable=opcao,
value=2, command=selecionar,
bg="#d9ead3",fg="#3174a7",font=("Arial","12","bold"))
c.place(relx=0.45, rely=0.4)
d=Radiobutton(root, text="D-7", variable=opcao,
value=3, command=selecionar,
bg="#d9ead3",fg="#3174a7",font=("Arial","12","bold"))
d.place(relx=0.45, rely=0.5) butao=Button(root, text="Reiniciar", command=reset,bg='#107db2',
fg='white', bd=2,font=('verdana', 12, 'bold'))
butao.place(relx=0.3, rely=0.65)
but_sair = Button(text="Sair", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=root.destroy)
but_sair.place(relx=0.6, rely=0.65)
monitor = Label(root,font=('verdana', 13, 'bold'),bg='#d9ead3',fg="#bf9000")
monitor.place(relx=0.3, rely=0.85)
root.mainloop()
0