and thanks i am running this code. At no time does it generate an error, it just doesn't convert me from feet to meters. (Can you check and tell me where it's wrong?)
There would be 2 options to get the result, adding the numeric and pressing enter or with the calculate button. Neither of them work.
from tkinter import *
root =Tk()
root.title("Pies a metros")
def calcular(*args):
try:
value = float(pies.get())
m = int(0.3048 * value * 10000 +0.5)/10000
metros.set(m)
except ValueError:
metros.set("ERROR")
frame = Frame(root, pady=3, padx=12)
frame.grid(column=0, row=0)
pies = StringVar()
pies_input = Entry(frame, width=7, textvariable=pies)
pies_input.grid(column=1, row=0)
metros = StringVar()
Label(frame, textvariable=metros).grid(column=2, row=2)
Button(frame, text="Calcular", command=calcular).grid(column=2, row=2)
Label(frame, text="Pies").grid(column=0, row=0)
Label(frame, text="es igual a").grid(column=0, row=1)
Label(frame, text="metros").grid(column=2, row=1)
pies_input.focus()
root.bind("<Return>", calcular)
root.mainloop()