Mundo em Python

Calcular data de Páscoa

from tkinter import *
root = Tk()
root.geometry("400x400")
root.resizable(0, 0)
root.config(bg="#285061")
root.title("Calcular data de Páscoa") titulo = Label(text="Calcular data de Páscoa",
font=("Arial", "25", "bold"),bg="#285061",fg="#65c6f0")
titulo.place(relx=0.03, rely=0.05)
texto_sub1 = Label(text="Ano:",
font=("Arial", "20", "bold"),bg="#285061",fg="#65c6f0")
texto_sub1.place(relx=0.25, rely=0.25)
ano = IntVar()
ano_entrada = Entry(textvariable=ano,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
ano_entrada.place(relx=0.5, rely=0.26, relwidth=0.35) def limpar():
ano_entrada.delete(0, END)
resultado.set("") def app():
year = ano.get()
X = 24
Y = 5
a = year % 19
b = year % 4
c = year % 7
d = (19 * a + X) % 30
e = (2 * b + 4 * c + 6 * d + Y) % 7
if (d + e) > 9:
dia = (d + e - 9)
mes = 4 # Abril
else:
dia = (d + e + 22)
mes = 3 # Março

mensagem = f"A Páscoa em {year} será em {dia}/{mes}/{year}"
resultado.set(mensagem) but1 = Button(text="Calcular", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=app)
but1.place(relx=0.05, rely=0.5, 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.5, 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.5, relwidth=0.25, relheight=0.1) 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.2)
root.mainloop()
0