Mundo em Python

Pedido de casamento

from tkinter import *
from tkinter import messagebox
import random # Quando aceita 💍
def aceitou():
messagebox.showinfo("", "Eu sabia!!! \nAmo-te para sempre ❤️") # Botão NÃO foge 😄
def fugir(event):
x = random.randint(0, 250)
y = random.randint(0, 150)
btn_nao.place(x=x, y=y) # Janela principal
root = Tk()
root.title("Pedido de casamento")
root.geometry("400x250")
root.resizable(False, False)
root.config(bg="#FF69B4") # Frame para texto principal
frame_texto = Frame(root, bg="#FF69B4")
frame_texto.pack(pady=20) # Texto parte 1
Label(
frame_texto,
text="Desde o dia em que te conheci...\nMinha vida ficou mais bonita ",
font=("Arial", 12),
bg="#FF69B4"
).pack(side="left") # Coração vermelho ❤️
Label(
frame_texto,
text="❤️",
font=("Arial", 12),
fg="red",
bg="#FF69B4"
).pack(side="left") # Texto parte 2
Label(
root,
text="\n\nQuer casar comigo?",
font=("Arial", 12),
bg="#FF69B4"
).pack() # Botão SIM
btn_sim = Button(
root,
text="SIM",
font=("Arial", 15),
command=aceitou,
bg="#C08081"
)
btn_sim.place(x=80, y=170) # Botão NÃO
btn_nao = Button(
root,
text="Não",
font=("Arial", 15),
bg="#FF0000"
)
btn_nao.place(x=220, y=170)
btn_nao.bind("<Enter>", fugir) root.mainloop()
0