from tkinter import *
# Dados das Forças Armadas Portuguesas
patentes = {
"Marinha": {
"Oficiais Gerais": ["Almirante da Armada", "Almirante", "Vice-Almirante", "Contra-Almirante", "Comodoro"],
"Oficiais Superiores": ["Capitão de Mar e Guerra", "Capitão de Fragata", "Capitão-Tenente"],
"Oficiais Intermediários": ["Primeiro-Tenente"],
"Oficiais Subalternos": ["Segundo-Tenente", "Guarda-Marinha", "Aspirante"],
"Sargentos e Praças": [
"Sargento-Mor", "Sargento-Chefe", "Sargento-Ajudante",
"Primeiro-Sargento", "Segundo-Sargento", "Cabo",
"Primeiro-Marinheiro", "Segundo-Grumete"
]
},
"Exército": {
"Oficiais Gerais": ["Marechal", "General", "Tenente-General", "Major-General", "Brigadeiro-General"],
"Oficiais Superiores": ["Coronel", "Tenente-Coronel", "Major"],
"Oficiais Intermediários": ["Capitão"],
"Oficiais Subalternos": ["Tenente", "Alferes", "Aspirante"],
"Sargentos e Praças": [
"Sargento-Mor", "Sargento-Chefe", "Sargento-Ajudante",
"Primeiro-Sargento", "Segundo-Sargento", "Furriel",
"Segundo-Furriel", "Cabo", "Segundo-Grumete", "Soldado"
]
},
"Força Aérea": {
"Oficiais Gerais": ["Marechal", "General", "Tenente-General", "Major-General", "Brigadeiro-General"],
"Oficiais Superiores": ["Coronel", "Tenente-Coronel", "Major"],
"Oficiais Intermediários": ["Capitão"],
"Oficiais Subalternos": ["Tenente", "Alferes", "Aspirante"],
"Sargentos e Praças": [
"Sargento-Mor", "Sargento-Chefe", "Sargento-Ajudante",
"Primeiro-Sargento", "Segundo-Sargento", "Cabo Adjunto",
"Primeiro-Cabo", "Segundo-Cabo", "Soldado"
]
}
}
# Função para mostrar patentes
def mostrar_patentes():
# Limpa a lista anterior
listbox_resultado.delete(0, END)
# Adiciona patentes correspondentes
for patente in patentes[var1.get()][var2.get()]:
listbox_resultado.insert(END, patente)
# Janela principal
root = Tk()
root.geometry("700x500")
root.resizable(0, 0)
root.config(bg="#103030")
root.title("Forças Armadas Portuguesas")
# Título
titulo = Label(
root,
text="Forças Armadas Portuguesas",
font=("Arial", 28, "bold"),
bg="#103030",
fg="#49e3e3"
)
titulo.place(relx=0.05, rely=0.02)
# Dropdown Força
var1 = StringVar()
dropDownList1 = ["Exército", "Marinha", "Força Aérea"]
dropdown1 = OptionMenu(root, var1, *dropDownList1)
var1.set(dropDownList1[0])
dropdown1.place(relx=0.05, rely=0.15, relwidth=0.4)
dropdown1.config(background='#09A3BA', foreground="#FFFFFF", font=("Arial", 15, "bold"))
dropdown1["menu"].config(background='#09A3BA', foreground="#FFFFFF", font=("Arial", 15, "bold"))
# Dropdown Categoria
var2 = StringVar()
dropDownList2 = [
"Oficiais Gerais",
"Oficiais Superiores",
"Oficiais Intermediários",
"Oficiais Subalternos",
"Sargentos e Praças"
]
dropdown2 = OptionMenu(root, var2, *dropDownList2)
var2.set(dropDownList2[0])
dropdown2.place(relx=0.55, rely=0.15, relwidth=0.4)
dropdown2.config(background='#09A3BA', foreground="#FFFFFF", font=("Arial", 15, "bold"))
dropdown2["menu"].config(background='#09A3BA', foreground="#FFFFFF", font=("Arial", 15, "bold"))
# Botão para mostrar patentes
botao_mostrar = Button(
root,
text="Mostrar Patentes",
font=("Arial", 15, "bold"),
bg="#49e3e3",
fg="#103030",
command=mostrar_patentes
)
botao_mostrar.place(relx=0.35, rely=0.28)
# Frame e scroll para lista rolável de patentes
frame_resultado = Frame(root, bg="#103030")
frame_resultado.place(relx=0.05, rely=0.35, relwidth=0.9, relheight=0.6)
scrollbar = Scrollbar(frame_resultado)
scrollbar.pack(side=RIGHT, fill=Y)
listbox_resultado = Listbox(
frame_resultado,
font=("Arial", 14),
bg="#103030",
fg="#FFFFFF",
yscrollcommand=scrollbar.set
)
listbox_resultado.pack(fill=BOTH, expand=True)
scrollbar.config(command=listbox_resultado.yview)
root.mainloop()