Mundo em Python

Simulador de Humor

from tkinter import *
import random humores = [
"Radiante como um sol de verão!",
"Produtivo e focado (o café finalmente bateu).",
"Com a energia de um bicho-preguiça numa segunda-feira.",
"Inspirado e pronto para dominar o mundo.",
"Meio 'nhé', mas sobrevivendo.",
"Explosivo! (Cuidado, área sob pressão).",
"Zen, em paz com o universo."
] root = Tk()
root.geometry("400x400")
root.resizable(0, 0)
root.config(bg="#103030")
root.title("Simulador de Humor") titulo = Label(
text="Simulador de Humor",
font=("Arial", 28, "bold"),
bg="#103030",
fg="#49e3e3"
)
titulo.place(relx=0.05, rely=0.05)
def limpar():
resultado_texto.config(text="")
def app():
humor_escolhido = random.choice(humores)
resultado_texto.config(text=humor_escolhido)
but1 = Button(
text="Simular",
bd=2,
bg='#107db2',
fg='white',
font=('verdana', 12, 'bold'),
command=app
)
but1.place(relx=0.1, rely=0.3, 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.4, rely=0.3, 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.7, rely=0.3, relwidth=0.25, relheight=0.1) resultado_texto = Label(
text="",
font=("Arial", 12, "bold"),
bg="#cfe2f3",
wraplength=320,
justify="center"
)
resultado_texto.place(relx=0.05, rely=0.45, relwidth=0.9, relheight=0.45) root.mainloop()
0