from tkinter import *
root = Tk()
root.geometry("650x400")
root.resizable(0, 0)
root.config(bg="#d9ead3")
root.title("Calcular o PIB")
def app():
C =consumo.get()
I = investimento.get()
G = gasto_publico.get()
X = exportacao.get()
M = importacao.get()
PIB = C + I + G + (X - M)
resultado_PIB.set(PIB)
def limpar():
consumo_entrada.delete(0, END)
investimento_entrada.delete(0, END)
gasto_publico_entrada.delete(0, END)
exportacao_entrada.delete(0, END)
importacao_entrada.delete(0, END)
titulo = Label(text="Calcular o PIB",
font=("Arial", "18", "bold"),bg="#d9ead3",fg="#bf9000")
titulo.place(relx=0.35, rely=0.05)
sub1_texto= Label(text="Consumo privado de bens e serviços:",
font=("Arial", "13", "bold"),bg="#d9ead3",fg="#bf9000")
sub1_texto.place(relx=0.2, rely=0.15)
sub2_texto= Label(text="investimento bruto (privado):",
font=("Arial", "13", "bold"),bg="#d9ead3",fg="#bf9000")
sub2_texto.place(relx=0.3, rely=0.25)
sub3_texto= Label(text="Gastos governamentais (consumo e investimento):",
font=("Arial", "13", "bold"),bg="#d9ead3",fg="#bf9000")
sub3_texto.place(relx=0.05, rely=0.35)
sub4_texto= Label(text="Exportações de bens e serviços:",
font=("Arial", "13", "bold"),bg="#d9ead3",fg="#bf9000")
sub4_texto.place(relx=0.28, rely=0.45)
sub5_texto= Label(text="Importação de bens e serviços:",
font=("Arial", "13", "bold"),bg="#d9ead3",fg="#bf9000")
sub5_texto.place(relx=0.28, rely=0.55)
consumo = DoubleVar()
consumo_entrada = Entry(textvariable=consumo,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
consumo_entrada.place(relx=0.7, rely=0.15, relwidth=0.2)
investimento = DoubleVar()
investimento_entrada = Entry(textvariable=investimento,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
investimento_entrada.place(relx=0.7, rely=0.25, relwidth=0.2)
gasto_publico = DoubleVar()
gasto_publico_entrada = Entry(textvariable=gasto_publico,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
gasto_publico_entrada.place(relx=0.7, rely=0.35, relwidth=0.2)
exportacao = DoubleVar()
exportacao_entrada = Entry(textvariable=exportacao,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
exportacao_entrada.place(relx=0.7, rely=0.45, relwidth=0.2)
importacao = DoubleVar()
importacao_entrada = Entry(textvariable=importacao,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
importacao_entrada.place(relx=0.7, rely=0.55, relwidth=0.2)
#
but1 = Button(text="Verificar", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=app)
but1.place(relx=0.05, rely=0.7, relwidth=0.25, relheight=0.05)
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.7, relwidth=0.25, relheight=0.05)
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.7, relwidth=0.25, relheight=0.05)
sub6_texto= Label(text="Resultado do PIB:",
font=("Arial", "13", "bold"),bg="#d9ead3",fg="#bf9000")
sub6_texto.place(relx=0.25, rely=0.85)
resultado_PIB = StringVar()
sub6_texto= Label(textvariable=resultado_PIB,
font=("Arial", "13", "bold"),bg="#d9ead3",fg="#bf9000")
sub6_texto.place(relx=0.65, rely=0.85)
root.mainloop()