from tkinter import *
def selecionar():
global resposta1, resposta2, resposta3, resposta4, resposta5
# Contagem de respostas positivas
positivos = resposta1.get() + resposta2.get() + resposta3.get() + resposta4.get() + resposta5.get()
if resposta1.get() ==1:
a.config(bg="green")
else:
a.config(bg="red")
if resposta2.get() == 1:
b.config(bg="green")
else:
b.config(bg="red")
if resposta3.get() == 1:
c.config(bg="green")
else:
c.config(bg="red")
if resposta4.get() == 1:
d.config(bg="green")
else:
d.config(bg="red")
if resposta5.get() == 1:
e.config(bg="green")
else:
e.config(bg="red")
# Lógica de classificação
if positivos ==0:
mensagem = "Nenhuma tarefas feitas"
elif positivos <= 2:
mensagem="Poucas tarefas feitas"
elif positivos < 5:
mensagem="Tarefas todas quase feitas"
else:
mensagem="Tarefas todos feitas"
resultado.set(mensagem)
root = Tk()
root.geometry("500x500")
root.resizable(0, 0)
root.title("Tarefas Feitas")
root.config(bg="#103030")
titulo = Label(text="Tarefas Feitas",
font=("Arial", "25", "bold"), bg="#103030", fg="#49e3e3")
titulo.place(relx=0.25, rely=0.05)
texto_sub1 = Label(text="Limpar a Mesa ",
font=("Arial", "15", "bold"), bg="#103030", fg="#49e3e3")
texto_sub1.place(relx=0.05, rely=0.2)
# Radiobuttons para a primeira pergunta
resposta1 = IntVar()
Radiobutton(root, text="Feito", variable=resposta1, value=1, command=selecionar,
font=("Arial", "12"), bg="#103030", fg="black").place(relx=0.4, rely=0.2)
Radiobutton(root, text="Não Feito", variable=resposta1, value=0, command=selecionar,
font=("Arial", "12"), bg="#103030", fg="black").place(relx=0.55, rely=0.2)
a = Label(font=("Arial", "15", "bold"), bg="red")
a.place(relx=0.75, rely=0.2, relwidth=0.15)
texto_sub2 = Label(text="Arrumar o Quarto ",
font=("Arial", "15", "bold"), bg="#103030", fg="#49e3e3")
texto_sub2.place(relx=0.05, rely=0.3)
# Radiobuttons para a segunda pergunta
resposta2 = IntVar()
Radiobutton(root, text="Feito", variable=resposta2, value=1, command=selecionar,
font=("Arial", "12"), bg="#103030", fg="black").place(relx=0.4, rely=0.3)
Radiobutton(root, text="Não Feito", variable=resposta2, value=0, command=selecionar,
font=("Arial", "12"), bg="#103030", fg="black").place(relx=0.55, rely=0.3)
b = Label(font=("Arial", "15", "bold"), bg="red")
b.place(relx=0.75, rely=0.3, relwidth=0.15)
texto_sub3 = Label(text="Cavar a Terra",
font=("Arial", "15", "bold"), bg="#103030", fg="#49e3e3")
texto_sub3.place(relx=0.05, rely=0.4)
# Radiobuttons para a terceira pergunta
resposta3 = IntVar()
Radiobutton(root, text="Feito", variable=resposta3, value=1, command=selecionar,
font=("Arial", "12"), bg="#103030", fg="black").place(relx=0.4, rely=0.4)
Radiobutton(root, text="Não Feito", variable=resposta3, value=0, command=selecionar,
font=("Arial", "12"), bg="#103030", fg="black").place(relx=0.55, rely=0.4)
c = Label(font=("Arial", "15", "bold"), bg="red")
c.place(relx=0.75, rely=0.4, relwidth=0.15)
texto_sub4 = Label(text="Arrumar os casacos",
font=("Arial", "15", "bold"), bg="#103030", fg="#49e3e3")
texto_sub4.place(relx=0.01, rely=0.5)
# Radiobuttons para a quarta pergunta
resposta4 = IntVar()
Radiobutton(root, text="Feito", variable=resposta4, value=1, command=selecionar,
font=("Arial", "12"), bg="#103030", fg="black").place(relx=0.4, rely=0.5)
Radiobutton(root, text="Não Feito", variable=resposta4, value=0, command=selecionar,
font=("Arial", "12"), bg="#103030", fg="black").place(relx=0.55, rely=0.5)
d = Label(font=("Arial", "15", "bold"), bg="red")
d.place(relx=0.75, rely=0.5, relwidth=0.15)
texto_sub5 = Label(text="Limpar os sapatos",
font=("Arial", "15", "bold"), bg="#103030", fg="#49e3e3")
texto_sub5.place(relx=0.05, rely=0.6)
# Radiobuttons para a quinta pergunta
resposta5 = IntVar()
Radiobutton(root, text="Feito", variable=resposta5, value=1, command=selecionar,
font=("Arial", "12"), bg="#103030", fg="black").place(relx=0.4, rely=0.6)
Radiobutton(root, text="Não Feito", variable=resposta5, value=0, command=selecionar,
font=("Arial", "12"), bg="#103030", fg="black").place(relx=0.55, rely=0.6)
e = Label(font=("Arial", "15", "bold"), bg="red")
e.place(relx=0.75, rely=0.6, relwidth=0.15)
resultado = StringVar()
resultado_texto = Label(textvariable=resultado,
font=("Arial", 12, "bold"), bg="#cfe2f3")
resultado_texto.place(relx=0.05, rely=0.75, relwidth=0.9, relheight=0.18)
root.mainloop()