from tkinter import *
import random
root = Tk()
root.geometry("400x200")
root.resizable(0, 0)
root.config(bg="#103030")
root.title("Doçura ou Travessura")
titulo = Label(text="Doçura ou Travessura",
font=("Arial", "24", "bold"), bg="#103030", fg="#49e3e3")
titulo.place(relx=0.08, rely=0.05)
def docura_ou_travessura(event):
resultado = random.choice(["doçura", "travessura"])
if resultado == "doçura":
mensagem ="Você ganhou um doce!"
else:
mensagem ="Travessura!\n Prepare-se para o susto!"
texto_sub1.config(text=mensagem)
but1 = Button(text="Mostrar", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=docura_ou_travessura)
but1.place(relx=0.1, rely=0.8, relwidth=0.25, relheight=0.1)
root.bind('<Return>', docura_ou_travessura)
texto_sub1 = Label(text="",
font=("Arial", "18", "bold"), bg="#103030", fg="#49e3e3")
texto_sub1.place(relx=0.08, rely=0.4)
root.mainloop()
Comentários
Enviar um comentário