from tkinter import *
root=Tk()
root.title("Calculadora de preços de supermercado")
root.geometry("380x240")
root.resizable(False,False)
def calcular():
valor=int(v.get())
if valor==0:
res_but.set(int(quantidade.get())*200)
elif valor==1:
res_but.set(int(quantidade.get())*600)
elif valor==2:
res_but.set(int(quantidade.get())*500)
elif valor==3:
res_but.set(int(quantidade.get())*400)
texto=Label(root,text="Escolhe o Item...", font=("Arial","12","bold"))
texto.place(relx=0.05,rely=0.05)
v = IntVar()
r_btn=Radiobutton(root,text="Leite ",variable=v,value=0)
r_btn.place(relx=0.5,rely=0.15)
res_but = IntVar()
r_btn2=Radiobutton(root,text="Maça",variable=v,value=1)
r_btn2.place(relx=0.5,rely=0.25)
r_btn3=Radiobutton(root,text="Chocolate",variable=v,value=2)
r_btn3.place(relx=0.5,rely=0.35)
r_btn4=Radiobutton(root,text="Hamburger",variable=v,value=3)
r_btn4.place(relx=0.5,rely=0.45)
# Quantidade
texto2 = Label(text="Quantidade ")
texto2.place(relx=0.15,rely=0.6)
quantidade=Entry(root,width=25)
quantidade.place(relx=0.35,rely=0.6)
# Butão
btn=Button(root,text="Calcular",highlightbackground="gray",command=lambda : calcular())
btn.place(relx=0.45,rely=0.7)
# Preço
#
texto_resultado = Label(text="Valor Total ")
texto_resultado.place(relx=0.2,rely=0.85)
resultado=Entry(root,textvariable=res_but)
resultado.place(relx=0.45,rely=0.85)
resultado.config(state = "readonly")
root.mainloop()