Advertisement
Guest User

Untitled

a guest
Aug 25th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. this is the code of the new window:
  2.  
  3. class GUIPrestitoLibro:
  4. import datetime
  5.  
  6. def __init__(self, id):
  7. self.GestioneLibri=GestioneLibri()
  8. self.finestraPrestito=Tk()
  9. self.finestraPrestito.geometry()
  10. self.finestraPrestito.title("Prestito/consultazione")
  11. today = datetime.today()
  12.  
  13. idLibroLabel=Label(self.finestraPrestito, text="ID libro:").grid(row=1, column=0)
  14. self.idLibro=StringVar(value=id)
  15. idLibro=Entry(self.finestraPrestito, textvariable=self.idLibro, state="readonly").grid(row=1, column=1)
  16.  
  17. idUtenteLabel=Label(self.finestraPrestito, text="ID utente:").grid(row=2, column=0)
  18. self.idUtente=StringVar()
  19. idUtente=Entry(self.finestraPrestito, textvariable=self.idUtente).grid(row=2, column=1)
  20.  
  21. dataInizioPrestitoLabel=Label(self.finestraPrestito, text="Data inizio prestito:").grid(row=3, column=0)
  22. self.dataInizioPrestito=StringVar(value=today.strftime("%d/%m/%Y"))
  23. dataInizioPrestito=Entry(self.finestraPrestito, textvariable=self.dataInizioPrestito, state="readonly").grid(row=3, column=1)
  24.  
  25. dataFinePrestitoLabel=Label(self.finestraPrestito, text="Data fine prestito:").grid(row=4, column=0)
  26. self.dataFinePrestito=StringVar()
  27. dataFinePrestito=Entry(self.finestraPrestito, textvariable=self.dataFinePrestito).grid(row=4, column=1)
  28.  
  29. registra=Button(self.finestraPrestito, text="conferma", command=self.registraPrestito).grid(row=5, column=0)
  30. resetta=Button(self.finestraPrestito, text="resetta", command=self.resettaCampi).grid(row=5, column=1)
  31.  
  32. self.finestraPrestito.mainloop()
  33.  
  34.  
  35. def resettaCampi(self):
  36. self.idUtente.set("")
  37. self.dataFinePrestito.set("")
  38.  
  39. def registraPrestito(self):
  40. self.GestioneLibri.prestitoLibro(self.idLibro.get(), self.idUtente.get(), self.dataInizioPrestito.get(), self.dataFinePrestito.get())
  41. self.finestraPrestito.destroy()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement