Browse Source

commit

master
yasser.zebaier 7 months ago
commit
fbcf3ef035
  1. 28
      sujet4.py

28
sujet4.py

@ -0,0 +1,28 @@
import tkinter as tk
def convertir_pouces_en_mm(value):
result = value * 25.4
output_label.config(text=f"{result} mm")
def convertir_mm_en_pouces(value):
result = value / 25.4
output_label.config(text=f"{result} pouces")
root = tk.Tk()
entry_label = tk.Label(root, text="Entrer longueur:")
entry_label.pack()
entry = tk.Entry(root)
entry.pack()
output_label = tk.Label(root, text="")
output_label.pack()
convertir_pouces_button = tk.Button(root, text="Convertir pouces en mm", command=lambda: convertir_pouces_en_mm(float(entry.get())))
convertir_pouces_button.pack()
convertir_mm_button = tk.Button(root, text="Convertir mm en pouces", command=lambda: convertir_mm_en_pouces(float(entry.get())))
convertir_mm_button.pack()
root.mainloop()
Loading…
Cancel
Save