Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this is the code of the new window:
- class GUIPrestitoLibro:
- import datetime
- def __init__(self, id):
- self.GestioneLibri=GestioneLibri()
- self.finestraPrestito=Tk()
- self.finestraPrestito.geometry()
- self.finestraPrestito.title("Prestito/consultazione")
- today = datetime.today()
- idLibroLabel=Label(self.finestraPrestito, text="ID libro:").grid(row=1, column=0)
- self.idLibro=StringVar(value=id)
- idLibro=Entry(self.finestraPrestito, textvariable=self.idLibro, state="readonly").grid(row=1, column=1)
- idUtenteLabel=Label(self.finestraPrestito, text="ID utente:").grid(row=2, column=0)
- self.idUtente=StringVar()
- idUtente=Entry(self.finestraPrestito, textvariable=self.idUtente).grid(row=2, column=1)
- dataInizioPrestitoLabel=Label(self.finestraPrestito, text="Data inizio prestito:").grid(row=3, column=0)
- self.dataInizioPrestito=StringVar(value=today.strftime("%d/%m/%Y"))
- dataInizioPrestito=Entry(self.finestraPrestito, textvariable=self.dataInizioPrestito, state="readonly").grid(row=3, column=1)
- dataFinePrestitoLabel=Label(self.finestraPrestito, text="Data fine prestito:").grid(row=4, column=0)
- self.dataFinePrestito=StringVar()
- dataFinePrestito=Entry(self.finestraPrestito, textvariable=self.dataFinePrestito).grid(row=4, column=1)
- registra=Button(self.finestraPrestito, text="conferma", command=self.registraPrestito).grid(row=5, column=0)
- resetta=Button(self.finestraPrestito, text="resetta", command=self.resettaCampi).grid(row=5, column=1)
- self.finestraPrestito.mainloop()
- def resettaCampi(self):
- self.idUtente.set("")
- self.dataFinePrestito.set("")
- def registraPrestito(self):
- self.GestioneLibri.prestitoLibro(self.idLibro.get(), self.idUtente.get(), self.dataInizioPrestito.get(), self.dataFinePrestito.get())
- self.finestraPrestito.destroy()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement