from tkinter import *
# Criação da janela principal
root = Tk()
root.geometry("700x450")
root.resizable(0, 0)
root.config(bg="#103030")
root.title("Classificação dos Furacões")
# Título
titulo = Label(
root,
text="Classificação dos Furacões",
font=("Arial", 28, "bold"),
bg="#103030",
fg="#49e3e3"
)
titulo.place(relx=0.12, rely=0.05)
# Label para o dropdown
texto_sub1 = Label(
root,
text="Escolha uma Hipótese:",
font=("Arial", 18, "bold"),
bg="#103030",
fg="#49e3e3"
)
texto_sub1.place(relx=0.05, rely=0.32)
# Dropdown
var = StringVar()
dropDownList = ["Tempestade Tropical", "Categoria 1", "Categoria 2",
"Categoria 3", "Categoria 4", "Categoria 5"]
dropdown = OptionMenu(root, var, *dropDownList)
var.set(dropDownList[0])
dropdown.place(relx=0.45, rely=0.33, relwidth=0.45)
dropdown.config(background='#09A3BA', foreground="#FFFFFF", font=("Arial", 18, "bold"))
dropdown["menu"].config(background='#09A3BA', foreground="#FFFFFF", font=("Arial", 18, "bold"))
# Função para mostrar o resultado
def app():
v = var.get()
if v == "Tempestade Tropical":
mensagem = ("Velocidade (km/h): 63–118\n"
"Exemplo histórico: Alberto (2018) – Atlântico\n"
"Impacto principal: Chuvas fortes, inundações leves, poucos danos estruturais.")
elif v == "Categoria 1":
mensagem = ("Velocidade (km/h): 119–153\n"
"Exemplo histórico: Hurricane Dolly (2008) – EUA\n"
"Impacto principal: Danos moderados a casas, quedas de árvores e blecautes curtos.")
elif v == "Categoria 2":
mensagem = ("Velocidade (km/h): 154–177\n"
"Exemplo histórico: Hurricane Irene (2011) – EUA\n"
"Impacto principal: Danos extensos, inundações, interrupção prolongada de energia elétrica.")
elif v == "Categoria 3":
mensagem = ("Velocidade (km/h): 178–208\n"
"Exemplo histórico: Hurricane Katrina (2005) – EUA\n"
"Impacto principal: Danos devastadores em Nova Orleans; centenas de milhares deslocados.")
elif v == "Categoria 4":
mensagem = ("Velocidade (km/h): 209–251\n"
"Exemplo histórico: Hurricane Harvey (2017) – EUA\n"
"Impacto principal: Danos catastróficos; inundações massivas, destruição de infraestrutura.")
else:
mensagem = ("Velocidade (km/h): ≥252\n"
"Exemplo histórico: Hurricane Patricia (2015) – México\n"
"Impacto principal: Destruição extrema; ventos recordes e danos generalizados.")
resultado_texto.config(text=mensagem)
# Função para limpar o resultado
def limpar():
resultado_texto.config(text="")
# Botões
but1 = Button(
root,
text="Mostrar",
bd=2,
bg='#107db2',
fg='white',
font=('verdana', 12, 'bold'),
command=app
)
but1.place(relx=0.1, rely=0.5, relwidth=0.25, relheight=0.1)
but_limpar = Button(
root,
text="Limpar",
bd=2,
bg='#107db2',
fg='white',
font=('verdana', 12, 'bold'),
command=limpar
)
but_limpar.place(relx=0.4, rely=0.5, relwidth=0.25, relheight=0.1)
but_sair = Button(
root,
text="Sair",
bd=2,
bg='#107db2',
fg='white',
font=('verdana', 12, 'bold'),
command=root.destroy
)
but_sair.place(relx=0.7, rely=0.5, relwidth=0.25, relheight=0.1)
# Label para resultado com wraplength para quebrar linhas automaticamente
resultado_texto = Label(
root,
text="",
font=("Arial", 14, "bold"),
bg="#cfe2f3",
justify=LEFT,
anchor="nw",
wraplength=650
)
resultado_texto.place(relx=0.05, rely=0.7, relwidth=0.9, relheight=0.25)
# Loop principal
root.mainloop()