From d44055d00ffba8e7aab69b94d90083214db3b29e Mon Sep 17 00:00:00 2001 From: Ambre Date: Sun, 5 May 2024 13:52:37 +0200 Subject: [PATCH] version semi finale --- tp imc.py | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/tp imc.py b/tp imc.py index 19e0ba6..463c7a9 100644 --- a/tp imc.py +++ b/tp imc.py @@ -72,28 +72,28 @@ def afficher_imc(): Label1.config(text="Vous etes en obesité sévere") canvas2.itemconfig(image_container2,image=image_obes_s) -lbl=tk.Label(fen, text="Votre imc est de :", font='Arial') -lbl.grid(column=0,row=1) -lbl=tk.Label(fen, text=imc, font='Arial') #afficher le resultat calcul imc -lbl.grid(column=0, row=2) - -# graphique -fig = Figure(figsize=(7.2, 5.2), dpi=96) -ax = fig.add_subplot(111) -ax.axis([100, 220, 0, 180]) #limite du graphe -x = np.linspace(100, 220) # les tailles extrèmes en cm - # 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, 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, 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.scatter(taille*100, poids, color='black')# point a placer sur le graphique - - -graph = FigureCanvasTkAgg(fig, master=fen) -canvas = graph.get_tk_widget() -canvas.grid(row=0, column=1) + lbl=tk.Label(fen, text="Votre imc est de :", font='Arial') + lbl.grid(column=0,row=1) + lbl=tk.Label(fen, text=imc, font='Arial') #afficher le resultat calcul imc + lbl.grid(column=0, row=2) + + # graphique + fig = Figure(figsize=(7.2, 5.2), dpi=96) + ax = fig.add_subplot(111) + ax.axis([100, 220, 0, 180]) #limite du graphe + x = np.linspace(100, 220) # les tailles extrèmes en cm + # 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, 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, 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.scatter(taille*100, poids, color='black')# point a placer sur le graphique + + + graph = FigureCanvasTkAgg(fig, master=fen) + canvas = graph.get_tk_widget() + canvas.grid(row=0, column=1) 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)