Browse Source

version semi finale

master
Ambre 7 months ago
parent
commit
d44055d00f
  1. 44
      tp imc.py

44
tp imc.py

@ -72,28 +72,28 @@ def afficher_imc():
Label1.config(text="Vous etes en obesité sévere") Label1.config(text="Vous etes en obesité sévere")
canvas2.itemconfig(image_container2,image=image_obes_s) canvas2.itemconfig(image_container2,image=image_obes_s)
lbl=tk.Label(fen, text="Votre imc est de :", font='Arial') lbl=tk.Label(fen, text="Votre imc est de :", font='Arial')
lbl.grid(column=0,row=1) lbl.grid(column=0,row=1)
lbl=tk.Label(fen, text=imc, font='Arial') #afficher le resultat calcul imc lbl=tk.Label(fen, text=imc, font='Arial') #afficher le resultat calcul imc
lbl.grid(column=0, row=2) lbl.grid(column=0, row=2)
# graphique # graphique
fig = Figure(figsize=(7.2, 5.2), dpi=96) fig = Figure(figsize=(7.2, 5.2), dpi=96)
ax = fig.add_subplot(111) ax = fig.add_subplot(111)
ax.axis([100, 220, 0, 180]) #limite du graphe ax.axis([100, 220, 0, 180]) #limite du graphe
x = np.linspace(100, 220) # les tailles extrèmes en cm x = np.linspace(100, 220) # les tailles extrèmes en cm
# cm//m # cm//m
ax.fill_between(x, 0, 18.4 * (x/100)**2, label="sous poids",color="LightBlue") # sous poids si 0 <= y <= 18.4 * x² ax.fill_between(x, 0, 18.4 * (x/100)**2, label="sous poids",color="LightBlue") # sous poids si 0 <= y <= 18.4 * x²
ax.fill_between(x, 18.5 * (x/100)**2, 24.9 * (x/100)**2, label="poids idéal",color="green") # idéal si 18.5 * x² <= y <= 24.9 * x² ax.fill_between(x, 18.5 * (x/100)**2, 24.9 * (x/100)**2, label="poids idéal",color="green") # idéal si 18.5 * x² <= y <= 24.9 * x²
ax.fill_between(x, 25 * (x/100)**2, 29.9 * (x/100)**2, label="surpoids",color="yellow") # surpoids si 25 * x² <= y <= 29.9 * x² ax.fill_between(x, 25 * (x/100)**2, 29.9 * (x/100)**2, label="surpoids",color="yellow") # surpoids si 25 * x² <= y <= 29.9 * x²
ax.fill_between(x, 30 * (x/100)**2, 34.9 * (x/100)**2, label="obesité",color="orange") # obésité si 30 * x² <= y <= 34.9 * x² ax.fill_between(x, 30 * (x/100)**2, 34.9 * (x/100)**2, label="obesité",color="orange") # obésité si 30 * x² <= y <= 34.9 * x²
ax.fill_between(x,180, 35 * (x/100)**2, 40 * (x/100)**2, label="obesité sévère",color="red") # obesité sevère si 35 * x² <= y ax.fill_between(x,180, 35 * (x/100)**2, 40 * (x/100)**2, label="obesité sévère",color="red") # obesité sevère si 35 * x² <= y
ax.scatter(taille*100, poids, color='black')# point a placer sur le graphique ax.scatter(taille*100, poids, color='black')# point a placer sur le graphique
graph = FigureCanvasTkAgg(fig, master=fen) graph = FigureCanvasTkAgg(fig, master=fen)
canvas = graph.get_tk_widget() canvas = graph.get_tk_widget()
canvas.grid(row=0, column=1) canvas.grid(row=0, column=1)
bouton=tk.Button(fen, text="Afficher l'IMC", command=afficher_imc) bouton=tk.Button(fen, text="Afficher l'IMC", command=afficher_imc)
bouton.grid(column=0, columnspan=2,ipadx=50, padx=10, pady=10, row=6) bouton.grid(column=0, columnspan=2,ipadx=50, padx=10, pady=10, row=6)

Loading…
Cancel
Save