Mundo em Python

Custo de Casamento (usando tkinter)

from tkinter import *
root = Tk()
root.geometry("800x450")
root.resizable(0, 0)
root.config(bg="#1b9ea1")
root.title("Calcular Custo Casamento")
titulo = Label(text="Calcular Custo Casamento",
font=("Arial", "20", "bold"),bg="#1b9ea1",fg="#e1eaeb")
titulo.place(relx=0.25, rely=0.05)
texto_sub1 = Label(text="Custo Local: ",
font=("Arial", "15", "bold"),bg="#1b9ea1",fg="#e1eaeb")
texto_sub1.place(relx=0.05, rely=0.25) texto_sub2 = Label(text="Custo Decoração: ",
font=("Arial", "15", "bold"),bg="#1b9ea1",fg="#e1eaeb")
texto_sub2.place(relx=0.5, rely=0.25) texto_sub3 = Label(text="Custo da comida: ",
font=("Arial", "15", "bold"),bg="#1b9ea1",fg="#e1eaeb")
texto_sub3.place(relx=0.02, rely=0.4) texto_sub4 = Label(text="Custo das Roupas: ",
font=("Arial", "15", "bold"),bg="#1b9ea1",fg="#e1eaeb")
texto_sub4.place(relx=0.5, rely=0.4) texto_sub5 = Label(text="Custo das convites: ", font=("Arial", "15", "bold"),bg="#1b9ea1",fg="#e1eaeb")
texto_sub5.place(relx=0.03, rely=0.55) texto_sub6 = Label(text="Custo das fotografia: ",
font=("Arial", "15", "bold"),bg="#1b9ea1",fg="#e1eaeb")
texto_sub6.place(relx=0.5, rely=0.55)
texto_sub7 = Label(text="Outros Custos: ",
font=("Arial", "15", "bold"),bg="#1b9ea1",fg="#e1eaeb")
texto_sub7.place(relx=0.55, rely=0.67) texto_sub8 = Label(text="Custos de Música: ",
font=("Arial", "15", "bold"),bg="#1b9ea1",fg="#e1eaeb")
texto_sub8.place(relx=0.03, rely=0.67) Custo_Local = DoubleVar()
Custo_Local_entrada = Entry(textvariable=Custo_Local,font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Custo_Local_entrada.place(relx=0.23, rely=0.25, relwidth=0.2) Custo_Decoração = DoubleVar()
Custo_Decoração_entrada = Entry(textvariable=Custo_Decoração,font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Custo_Decoração_entrada.place(relx=0.78, rely=0.25, relwidth=0.2) Custo_comida = DoubleVar()
Custo_comida_entrada = Entry(textvariable=Custo_comida,font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Custo_comida_entrada.place(relx=0.23, rely=0.4, relwidth=0.2) Custo_Roupas = DoubleVar()
Custo_Roupas_entrada = Entry(textvariable=Custo_Roupas,font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Custo_Roupas_entrada.place(relx=0.78, rely=0.4, relwidth=0.2) Custo_convites = DoubleVar()
Custo_convites_entrada = Entry(textvariable=Custo_convites,font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Custo_convites_entrada.place(relx=0.28, rely=0.55, relwidth=0.2) Custo_fotografia = DoubleVar()
Custo_fotografia_entrada = Entry(textvariable=Custo_fotografia,font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Custo_fotografia_entrada.place(relx=0.77, rely=0.55, relwidth=0.2)
Custo_musica = DoubleVar()
Custo_musica_entrada = Entry(textvariable=Custo_musica,font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Custo_musica_entrada.place(relx=0.3, rely=0.67, relwidth=0.2) Custo_outros = DoubleVar()
Custo_outros_entrada = Entry(textvariable=Custo_outros,font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Custo_outros_entrada.place(relx=0.78, rely=0.67, relwidth=0.2) def limpar():
Custo_Local_entrada.delete(0, END)
Custo_Decoração_entrada.delete(0, END)
Custo_comida_entrada.delete(0, END)
Custo_convites_entrada.delete(0, END)
Custo_Roupas_entrada.delete(0, END)
Custo_outros_entrada.delete(0, END)
Custo_fotografia_entrada.delete(0, END)
Custo_musica_entrada.delete(0, END) def app ():
cd = Custo_Decoração.get()
co = Custo_outros.get()
cm = Custo_musica.get()
vf = Custo_fotografia.get()
cr = Custo_Roupas.get()
c_comida = Custo_comida.get()
c_convite = Custo_convites.get()
cl = Custo_Local.get()
c_total = cd + co + cm +vf +c_comida+c_convite+cl +cr
mensagem = f"Custo Total de um casamento: {c_total}"
resultado.set(mensagem)
#
but1 = Button(text="Verificar", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=app)
but1.place(relx=0.05, rely=0.75, relwidth=0.25, 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.35, rely=0.75, relwidth=0.25, relheight=0.1) but_sair = Button(text="Sair", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=root.destroy)
but_sair.place(relx=0.65, rely=0.75, relwidth=0.25, relheight=0.1) resultado = StringVar()
resultado_texto = Label(textvariable=resultado,
font=("Arial", 12, "bold"), bg="#cfe2f3")
resultado_texto.place(relx=0.05, rely=0.88, relwidth=0.9,relheight=0.1) root.mainloop()
0