You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.2 KiB
41 lines
1.2 KiB
import tkinter as tk
|
|
|
|
|
|
def convkm() :
|
|
vts1 = value.get()
|
|
value.get() = vts1/1.609
|
|
print(value.get())
|
|
|
|
def convml() :
|
|
vts2 = value.get()
|
|
print(value.get())
|
|
|
|
|
|
|
|
|
|
fenetre = tk.Tk()
|
|
fenetre.title("convertisseur")
|
|
canvas = tk.Canvas(fenetre, width=500, height=500, bg='white')
|
|
|
|
tk.Label(text="Convertisseur de vitesse").grid(column= 1, columnspan= 3)
|
|
|
|
value = tk.DoubleVar()
|
|
value.set("Entrez vitesse en Km/h ou Mph")
|
|
entree = tk.Entry(fenetre, textvariable=value, width=30)
|
|
entree.grid(column=1, columnspan= 3)
|
|
tk.Button (fenetre, text ='Kilomètres -> Miles', command = convkm).grid(column=1,
|
|
row=2,
|
|
padx=5,
|
|
pady=5)
|
|
|
|
|
|
|
|
tk.Button (fenetre, text ='Miles -> Kilomètres', command = convml).grid(column=2,
|
|
row=2,
|
|
padx=5,
|
|
pady=5)
|
|
|
|
|
|
|
|
|
|
fenetre.mainloop()
|