from tkinter import *
root = Tk()
root.geometry("700x400")
root.resizable(0, 0)
root.config(bg="#103030")
root.title("Índice de Distância de Poder")
titulo = Label(
root,
text="Índice de Distância de Poder",
font=("Arial", 28, "bold"),
bg="#103030",
fg="#49e3e3"
)
titulo.place(relx=0.13, rely=0.05)
texto_sub1 = Label(
root,
text="Valor do País (0-100):",
font=("Arial", 18, "bold"),
bg="#103030",
fg="#49e3e3"
)
texto_sub1.place(relx=0.15, rely=0.32)
Valor_Pais = StringVar()
Valor_Pais_entrada = Entry(
root,
textvariable=Valor_Pais,
font=("Arial", 12, "bold"),
bg="white",
fg="blue",
justify='center'
)
Valor_Pais_entrada.place(relx=0.53, rely=0.33, relwidth=0.35)
Valor_Pais_entrada.focus()
def limpar():
Valor_Pais_entrada.delete(0, END)
resultado_texto.config(text="")
def app():
try:
valor = float(Valor_Pais.get())
if valor < 0:
mensagem = "Não pode haver números negativos."
elif valor <= 30:
mensagem = (
"Classificação: Baixa distância\n"
"Descrição: sociedades igualitárias, decisões participativas,\n"
"hierarquias flexíveis."
)
elif valor <= 70:
mensagem = (
"Classificação: Distância média\n"
"Descrição: hierarquias existem, mas há diálogo e\n"
"certo nível de autonomia."
)
elif valor <= 100:
mensagem = (
"Classificação: Alta distância\n"
"Descrição: hierarquias rígidas, respeito absoluto à autoridade,\n"
"pouca contestação."
)
else:
mensagem = "O valor não pode ser superior a 100."
resultado_texto.config(text=mensagem)
except ValueError:
resultado_texto.config(text="Por favor, insira valores numéricos válidos.")
but1 = Button(
root,
text="Classificar",
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)
# Resultado
resultado_texto = Label(
root,
text="",
font=("Arial", 12, "bold"),
bg="#cfe2f3",
justify="left"
)
resultado_texto.place(relx=0.05, rely=0.7, relwidth=0.9, relheight=0.25)
root.mainloop()