import tkinter as tk
import random
def gerar_premios():
lista = [
"250 €",
"250 €",
"500 €",
"500 €",
"Sem Prémio",
"Sem Prémio",
"750 €",
"Jackpot"
]
random.shuffle(lista)
return lista
def escolher_hipotese(indice):
resultado_text.delete(1.0, tk.END)
resultado_text.insert(tk.END, f"Escolheu a hipótese {indice + 1} e ganhou: {premios[indice]}\n\n")
resultado_text.insert(tk.END, "Veja os prêmios das outras hipóteses:\n")
for i, premio in enumerate(premios):
marcador = " <= sua escolha" if i == indice else ""
resultado_text.insert(tk.END, f"Hipótese {i + 1}: {premio}{marcador}\n")
for btn in botoes:
btn.config(state="disabled")
novo_jogo_btn.config(state="normal")
def novo_jogo():
global premios
premios = gerar_premios()
resultado_text.delete(1.0, tk.END)
for btn in botoes:
btn.config(state="normal")
novo_jogo_btn.config(state="disabled")
janela = tk.Tk()
janela.title("Jogo das Hipóteses")
instrucoes = tk.Label(janela, text="Escolha uma das 8 hipóteses:", font=("Arial", 14))
instrucoes.pack(pady=10)
frame_botoes = tk.Frame(janela)
frame_botoes.pack()
botoes = []
for i in range(8):
btn = tk.Button(frame_botoes, text=f"Hipótese {i + 1}", width=12, height=2,
command=lambda i=i: escolher_hipotese(i))
btn.grid(row=i // 4, column=i % 4, padx=5, pady=5)
botoes.append(btn)
resultado_text = tk.Text(janela, height=15, width=50, font=("Courier", 10))
resultado_text.pack(pady=10)
novo_jogo_btn = tk.Button(janela, text="Novo Jogo", font=("Arial", 12),
command=novo_jogo, state="disabled")
novo_jogo_btn.pack(pady=5)
premios = gerar_premios()
janela.mainloop()