from tkinter import *
import math
root = Tk()
root.title('VELOCIDADE DE AVANÇO')
root.geometry("600x350")
root.configure(background='#cfe2f3')
root.resizable(False, False)
def limpar():
Avanço_entrada.delete(0, END)
Velocidade_corte_entrada.delete(0, END)
diâmetro_entrada.delete(0, END)
def app():
v = Velocidade_corte.get()
f = Avanço.get()
d = diâmetro.get()
i = math.pi*d
y = 1000*v
g = (y/i)*f
varr = round(g,3)
resultado.set(varr)
texto_sub1 = Label(text="Avanço [mm/volta]: ", font=("Arial", "12", "bold"),bg="#cfe2f3",fg="#bf9000")
texto_sub1.place(relx=0.33, rely=0.1)
texto_sub2 = Label(text="Velocidade de Corte [m/min]:", font=("Arial", "12", "bold"),
bg="#cfe2f3",fg="#bf9000")
texto_sub2.place(relx=0.2, rely=0.25)
texto_sub3 = Label(text="Diâmetro da Peça [mm]]:", font=("Arial", "12", "bold"),
bg="#cfe2f3",fg="#bf9000")
texto_sub3.place(relx=0.2, rely=0.4)
Avanço = DoubleVar()
Avanço_entrada = Entry(textvariable=Avanço,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Avanço_entrada.place(relx=0.6, rely=0.1, relwidth=0.3)
Velocidade_corte = DoubleVar()
Velocidade_corte_entrada = Entry(textvariable=Velocidade_corte,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Velocidade_corte_entrada.place(relx=0.6, rely=0.25, relwidth=0.3)
diâmetro = DoubleVar()
diâmetro_entrada = Entry(textvariable=diâmetro,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
diâmetro_entrada.place(relx=0.6, rely=0.4, relwidth=0.3)
but1 = Button(text="Calcular", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=app)
but1.place(relx=0.3, rely=0.55, relwidth=0.2, relheight=0.1)
but_limpar = Button(text="Limpar", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=limpar)
but_limpar.place(relx=0.55, rely=0.55, relwidth=0.2, relheight=0.1)
texto = Label(text="Velocidade de Avanço",
font=("Arial", 12, "bold"), bg="#cfe2f3")
texto.place(relx=0.25, rely=0.8, relwidth=0.3)
resultado= StringVar()
resultado_texto = Label(textvariable=resultado,
font=("Arial", 12, "bold"), bg="#f0f8ff")
resultado_texto.place(relx=0.6, rely=0.8, relwidth=0.25)
root.mainloop()