Mundo em Python

Qual é o seu Signo?

from tkinter import *
root = Tk()
root.geometry("400x400")
root.resizable(0, 0)
root.config(bg="#136478")
root.title("Qual é o seu Signo?") titulo = Label(text="Qual é o seu Signo?",
font=("Arial", "25", "bold"),bg="#136478",fg="#edf3f5")
titulo.place(relx=0.15, rely=0.05)
texto_sub1 = Label(text="Dia de Nascimento: ",
font=("Arial", "18", "bold"),bg="#136478",fg="#edf3f5")
texto_sub1.place(relx=0.05, rely=0.25) texto_sub1 = Label(text="Mês de Nascimento: ",
font=("Arial", "18", "bold"),bg="#136478",fg="#edf3f5")
texto_sub1.place(relx=0.03, rely=0.4)
dia = IntVar()
dia_entrada = Entry(textvariable=dia,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
dia_entrada.place(relx=0.65, rely=0.27, relwidth=0.3) mes = IntVar()
mes_entrada = Entry(textvariable=mes,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
mes_entrada.place(relx=0.65, rely=0.42, relwidth=0.3)
def limpar():
mes_entrada.delete(0, END)
dia_entrada.delete(0, END)
resultado.set("")
def app():
d = dia.get()
m = mes.get()
if (m == 3 and d >= 21) or (m == 4 and d <= 20):
mensagem = "Você é Carneiro."
elif (m == 4 and d >= 21) or (m == 5 and d <= 20):
mensagem = "Você é Touro."
elif (m == 5 and d >= 21) or (m == 6 and d <= 20):
mensagem = "Você é Gémeos."
elif (m == 6 and d >= 21) or (m == 7 and d <= 22):
mensagem = "Você é Caranguejo."
elif (m == 7 and d >= 23) or (m == 8 and d <= 22):
mensagem = "Você é Leão."
elif (m == 8 and d >= 23) or (m == 9 and d <= 22):
mensagem = "Você é Virgem."
elif (m == 9 and d >= 23) or (m == 10 and d <= 22):
mensagem = "Você é Balança."
elif (m == 10 and d >= 23) or (m == 11 and d <= 21):
mensagem = "Você é Escorpião."
elif (m == 11 and d >= 22) or (m == 12 and d <= 21):
mensagem = "Você é Sagitário."
elif (m == 12 and d >= 22) or (m == 1 and d <= 20):
mensagem = "Você é Capricórnio."
elif (m == 1 and d >= 21) or (mes == 2 and d <= 19):
mensagem = "Você é Aquário."
elif (m == 2 and d >= 20) or (m == 3 and d <= 20):
mensagem = "Você é Peixes."
else:
mensagem = "Data inválida."
resultado.set(mensagem)
but1 = Button(text="Mostrar", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=app)
but1.place(relx=0.05, rely=0.55, relwidth=0.25, relheight=0.1)
but_limpar = Button(text="Limpar", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=limpar)
but_limpar.place(relx=0.35, rely=0.55, relwidth=0.25, relheight=0.1) but_sair = Button(text="Sair", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=root.destroy)
but_sair.place(relx=0.65, rely=0.55, relwidth=0.25, relheight=0.1)
resultado = StringVar()
resultado_texto = Label(textvariable=resultado,
font=("Arial", 14, "bold"), bg="#cfe2f3")
resultado_texto.place(relx=0.05, rely=0.7, relwidth=0.9,relheight=0.2)
root.mainloop()
0