PRJ ph2
PRJ ph2
def afficher_image():
ph = float(entry.get())
if ph < 6.5:
categorie = "acide"
elif 6.5 <= ph <= 7.5:
categorie = "neutre"
else:
categorie = "basique"
img = Image.open(images[categorie])
img = img.resize((300, 300))
img = ImageTk.PhotoImage(img)
label_img.config(image=img)
label_img.image = img
label_text.config(text=f"Sol {categorie} (pH = {ph})")
# Création de la fenêtre
root = tk.Tk()
root.title("Affichage de l'image selon le pH")
entry = tk.Entry(root)
entry.pack()
label_img = Label(root)
label_img.pack()
root.mainloop()