from tkinter import *
root= Tk()
root.geometry("400x400")
root.resizable(0, 0)
root.config(bg="#d9ead3")
def limpar():
Velocidade_entrada.delete(0, END)
Tempo_entrada.delete(0, END)
def app():
t = Tempo.get()
v = Velocidade.get()
d = t*v
resultado.set(d)
root.title("Calcular a distância percorrida")
titulo = Label(text="Calcular a distância percorrida",
font=("Arial", "15", "bold"),bg="#d9ead3",fg="#bf9000")
titulo.place(relx=0.15, rely=0.05)
texto_sub1 = Label(text="Velocidade (m/s):",
font=("Arial", "12", "bold"),bg="#d9ead3",fg="#bf9000")
texto_sub1.place(relx=0.2, rely=0.25)
texto_sub2 = Label(text="Tempo (em segundos):",
font=("Arial", "12", "bold"),bg="#d9ead3",fg="#bf9000")
texto_sub2.place(relx=0.1, rely=0.4)
Velocidade = DoubleVar()
Velocidade_entrada= Entry(textvariable=Velocidade,font=("Arial","12","bold"),
bg="white",fg="green",justify='center')
Velocidade_entrada.place(relx=0.6,rely=0.25,relwidth=0.25)
Tempo = IntVar()
Tempo_entrada= Entry(textvariable=Tempo,font=("Arial","12","bold"),
bg="white",fg="green",justify='center')
Tempo_entrada.place(relx=0.6,rely=0.4,relwidth=0.25)
butao_mostrar = Button(root, text="Calcular", bg="#466a8d",
font=("Arial","12","bold"),fg="white",command=app
)
butao_mostrar.place(relx=0.1,rely=0.55,relwidth=0.25)
butao_limpar = Button(root, text="Limpar", bg="#466a8d",
font=("Arial","12","bold"),fg="white",command=limpar
)
butao_limpar.place(relx=0.4,rely=0.55,relwidth=0.25)
butao_exit = Button(root, text="Sair", bg="#466a8d",
font=("Arial","12","bold"),fg="white"
,command=root.destroy)
butao_exit.place(relx=0.7,rely=0.55,relwidth=0.25)
texto_resultado = Label(text="Distância Percorrida",font=("Arial",12,"bold"),
bg="#d9ead3",fg="green")
texto_resultado.place(relx=0.1,rely=0.8)
resultado = StringVar()
vresultado = Label(textvariable=resultado,font=("Arial",12,"bold"),
bg="#c0ccc0",fg="green")
vresultado.place(relx=0.55,rely=0.8,relwidth=0.3)
root.mainloop()