Mundo em Python

Classificar Circunferência Abdominal

import tkinter as tk
from functools import partial
selected_gender = "Masculino"
def store_temp(sel_temp):
global selected_gender
selected_gender = sel_temp
def call_convert(rlabel1, inputn):
circunferencia = float(inputn.get())
mensagem = ""
if selected_gender == 'Masculino':
if circunferencia < 94:
mensagem = "Baixo Risco"
elif circunferencia < 102:
mensagem = "Risco Aumentado"
else:
mensagem = "Alto Risco"
elif selected_gender == 'Feminino':
if circunferencia < 80:
mensagem = "Baixo Risco"
elif circunferencia < 88:
mensagem = "Risco Aumentado"
else:
mensagem = "Alto Risco"

rlabel1.config(text=mensagem)
root = tk.Tk()
root.geometry('400x300')
root.title('Classificar Circunferência Abdominal')
root.configure(background='#09A3BA')
root.resizable(width=False, height=False)
root.grid_columnconfigure(1, weight=1)
root.grid_rowconfigure(0, weight=1)
numberInput = tk.StringVar()
titulo_label = tk.Label(root, text="Classificar Circunferência Abdominal", background='#09A3BA',
foreground="#FFFFFF", font=("arial","14","bold"))
titulo_label.place(relx=0.1, rely=0.05)
input_label = tk.Label(root, text="Circunferência Abdominal", background='#09A3BA',
foreground="#FFFFFF", font=("arial","12","bold"))
input_entry = tk.Entry(root, textvariable=numberInput)
input_label.place(relx=0.28, rely=0.25)
input_entry.place(relx=0.35, rely=0.4)
result_label1 = tk.Label(root, background='#09A3BA', foreground="#FFFFFF", font=("arial","15","bold"))
result_label1.place(relx=0.25, rely=0.85)
dropDownList = ["Masculino", "Feminino"]
var = tk.StringVar()
dropdown = tk.OptionMenu(root, var, *dropDownList, command=store_temp)
var.set(dropDownList[0])
dropdown.place(relx=0.35, rely=0.5)
dropdown.config(background='#09A3BA', foreground="#FFFFFF",font=("arial","15","bold"))
dropdown["menu"].config(background='#09A3BA', foreground="#FFFFFF") call_convert = partial(call_convert, result_label1, numberInput)
result_button = tk.Button(root, text="Calcular", command=call_convert, background='#09A3BA', foreground="#FFFFFF",
font=("arial","14","bold"))
result_button.place(relx=0.35, rely=0.7, relwidth=0.3) root.mainloop()
0