Mundo em Python

Factura (usando tkinter)

from tkinter import *
root = Tk()
root.geometry("550x600")
root.resizable(0, 0)
root.config(bg="#103030")
root.title("Factura")
titulo = Label(text="Factura",
font=("Arial", "40", "bold"), bg="#103030", fg="#49e3e3")
titulo.place(relx=0.25, rely=0.05) texto_sub1 = Label(text="Nome:",
font=("Arial", "15", "bold"), bg="#103030", fg="#49e3e3")
texto_sub1.place(relx=0.3, rely=0.25) texto_sub2 = Label(text="Dia Vencimento:",
font=("Arial", "15", "bold"), bg="#103030", fg="#49e3e3")
texto_sub2.place(relx=0.1, rely=0.35) texto_sub3 = Label(text="Mês Vencimento:",
font=("Arial", "15", "bold"), bg="#103030", fg="#49e3e3")
texto_sub3.place(relx=0.1, rely=0.45)
texto_sub4 = Label(text="Valor:",
font=("Arial", "15", "bold"), bg="#103030", fg="#49e3e3")
texto_sub4.place(relx=0.35, rely=0.55)
nome = StringVar()
nome_entrada = Entry(textvariable=nome,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
nome_entrada.place(relx=0.55, rely=0.25, relwidth=0.4)
Dia_Vencimento = IntVar()
Dia_Vencimento_entrada = Entry(textvariable=Dia_Vencimento,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Dia_Vencimento_entrada.place(relx=0.55, rely=0.35, relwidth=0.4) Mês_Vencimento = IntVar()
Mês_Vencimento_entrada = Entry(textvariable=Mês_Vencimento,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Mês_Vencimento_entrada.place(relx=0.55, rely=0.45, relwidth=0.4)
Valor = DoubleVar()
Valor_entrada = Entry(textvariable=Valor,
font=("Arial", "12", "bold"),
bg="white", fg="blue", justify='center')
Valor_entrada.place(relx=0.55, rely=0.55, relwidth=0.4)
def limpar():
Valor_entrada.delete(0, END)
Mês_Vencimento_entrada.delete(0, END)
Dia_Vencimento_entrada.delete(0, END)
nome_entrada.delete(0, END)
resultado.set("") def app():
n=nome.get()
dia=Dia_Vencimento.get()
mes = Mês_Vencimento.get()
v=Valor.get()
mensagem = f"Olá, {n},\n A sua fatura com vencimento em {dia} de {mes} no valor de {v}\n" \
f" está fechada está fechada."
resultado.set(mensagem) but1 = Button(text="Mostrar", bd=2, bg='#107db2', fg='white',
font=('verdana', 12, 'bold'), command=app)
but1.place(relx=0.05, rely=0.65, 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.65, 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.65, 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.8, relwidth=0.9,relheight=0.15)
root.mainloop()
0