Mundo em Python

Boas Festas (em símbolos químicos)

from tkinter import *
root = Tk()
root.geometry("400x400")
root.resizable(0, 0)
root.config(bg="#103030")
root.title("Boas Festas") # Título
titulo = Label(text="Boas Festas",
font=("Arial", "28", "bold"), bg="#103030", fg="#49e3e3")
titulo.place(relx=0.23, rely=0.05)
def app():
elementos_quimicos = {
"B": "Boro",
"O": "Oxigênio",
"As": "Arsênio",
"Fe": "Ferro",
"S": "Enxofre",
"Ta": "Tântalo"
} boas_festas = [
("B", "O", "As"), # Boas
("Fe", "S", "Ta", "S") # Festas
]
mensagem = ""
for palavra in boas_festas:
representacao = " ".join(palavra)
descricao = " , ".join([elementos_quimicos[elemento] for elemento in palavra])
mensagem += f"{representacao}\n({descricao})\n\n"
resultado_texto.config(text=mensagem.strip())
botao = Button(text="Gerar Mensagem", font=("Arial", 12, "bold"), bg="#107db2", fg="white", command=app)
botao.place(relx=0.3, rely=0.25, relwidth=0.4, relheight=0.1)
resultado_texto = Label(font=("Arial", 12, "bold"), bg="#cfe2f3", justify="center", anchor="center")
resultado_texto.place(relx=0.05, rely=0.4, relwidth=0.9, relheight=0.45)
root.mainloop()
0