Mundo em Python

Chá Revelação

from tkinter import *

root = Tk()
root.geometry("400x300")
root.resizable(0, 0)
root.config(bg="white")
root.title("Chá Revelação") titulo = Label(text="Chá Revelação",
font=("Arial", 28, "bold"), bg="white", fg="black")
titulo.place(relx=0.13, rely=0.05) a = Label(text="", font=("Arial", 12, "bold"), bg="#cfe2f3", anchor="center", justify="center")
a.place(relx=0.05, rely=0.2, relwidth=0.9, relheight=0.15) resultado_texto = Label(text="", font=("Arial", 45, "bold"), bg="#cfe2f3", anchor="center", justify="center")
resultado_texto.place(relx=0.05, rely=0.65, relwidth=0.9, relheight=0.15) contador = 5

def contagem():
global contador
if contador > 0:
a.config(text=f"A revelar em {contador}...")
contador -= 1
root.after(1000, contagem)
else:
revelar() def revelar():
sexo = "MENINA" # Altere para "MENINO" se for menino
cor = "#3399ff"
if sexo == "MENINO":
a.config(text="Vai ser um ...", bg=cor,font=('verdana',15, 'bold'))
titulo.config(bg=cor)
resultado_texto.config(text=sexo, fg="white", bg=cor, font=('verdana', 45, 'bold'))
else:
cor = "#ff66cc"
a.config(text="Vai ser uma ...", bg=cor,font=('verdana',15, 'bold'))
titulo.config(bg=cor)
resultado_texto.config(text=sexo, fg="white", bg=cor, font=('verdana', 45, 'bold'))
root.configure(bg=cor) def app():
global contador
contador = 10
botao_revelar.config(state="disabled")
resultado_texto.config(text="", bg="white")
a.config(bg="#cfe2f3", text="")
root.configure(bg="white")
contagem() botao_revelar = Button(text="Revelar o Sexo do Bebé", bd=2, bg='#107db2', fg='white',
font=('Verdana', 12, 'bold'), command=app)
botao_revelar.place(relx=0.25, rely=0.45, relwidth=0.55, relheight=0.1) root.mainloop()
0