i'm bulding a little app that uses a small UI to take info from the user, and after all the info is entered, the user can generate a PDF with every entry stored, like this:
As you can see in the image #2 to generate the PDF, i'm using a HTML template with jinja to pass the values with the following function:
**THIS IS A CLASS METHOD THAT RETURNS THE DATA TO GENERATE THE PDF**
def get_datos(self):
"""
Genera un diccionario con cada banco y la cantidad de depositos por banco
para poder generar los PDF de los depositos
"""
bancos = {}
montos_a_depositar = [a[2] for a in (r for r in self.get_listado_de_depositos())]
envasadoras = [str(a[3]).split(";")[0] for a in (r for r in self.get_listado_de_depositos())]
for i in (p for p in self.get_listado_de_depositos()):
bancos [i[1]] = bancos.get(i[1],0)+1
return (bancos,montos_a_depositar,envasadoras)
app = Flask(__name__)
@app.route("/")
def generador_depositos(banco):
fecha_deposito = datetime.today().strftime("%B %d, %Y")
#envasadora = ventana.self.get_listado_de_depositos()[0][3]
#monto = ventana.get_listado_de_depositos()[0][2]
return render_template(banco,fecha_deposito=fecha_deposito)
if __name__ == "__main__":
app_window = Tk()
app_window.geometry ("255x120")
a_generar = ventana(app_window)
app_window.mainloop()
it's still incomplete, but i hope you get idea, i want to pass the return of the get_datos function, but i don't know how to do that, if any advice on how to tackle this, would be welcome.