def afficheExtensions(idJeu, modeAdmin): def retourCatalogue(): fextension.destroy() return catalogue() def lancerEmprunt(i): fextension.destroy() return formulaireEmprunt(i) def lancerReserv(i): fextension.destroy() return reserver(i) fextension=Tk() fextension.title("Extension(s) du jeu ") fextension.grid_columnconfigure(0,weight=1) fextension.grid_rowconfigure(20,weight=21) p = PanedWindow(fextension, orient = HORIZONTAL, height=100, width=600) p.grid(row=1, column=1, columnspan=4) p.add(Label(p, text="Bonjour pseudo", bg="white", anchor=CENTER, width=20)) p.add(Button(p, text="Retour au catalogue", bg="orange", activebackground="orange", borderwidth=10, width=20, command= retourCatalogue )) if (modeAdmin): p.add(Button(p, text="Ajouter Extension", bg="cyan", activebackground="cyan", borderwidth=10, width=20, command=rien)) p.add(Button(p, text="Quitter", bg="white", activebackground="black", borderwidth=10, width=10, command = fextension.destroy )) if (Jeu.aDesExtensions(idJeu)==False): Label(fextension, text="Pas d'extension", bg="white", width=25).grid(row=2) else: Label(fextension, text="Nom Extension", bg="red", width=30).grid(row=2, column=2) #affiche "Nom Extension" au dessus des noms Label(fextension, text="Nom Jeu", bg="red", width=30).grid(row=2, column=1) j = Jeu.getExtensions(idJeu) k=3 for i in j: Label(fextension, text=str(Extension.getNomExtension(i[0])), bg="white", width=25).grid(row=k, column=2) Label(fextension, text=str(Jeu.getNomJeu(Extension.getIdJeu(i[0]))), bg="white", width=25).grid(row=k, column=1) Button(fextension, text="Emprunt", command = partial(lancerEmprunt, i[0]),bg="green", width=13,activebackground="green").grid(row=k, column=4) Button(fextension, text="Reserv", command = partial(lancerReserv, i[0]),bg="red", width=13,activebackground="red").grid(row=k, column=5) Label(fextension, text="Quantité disponible", bg="red", width=30).grid(row=2, column=3) Label(fextension, text=Extension.getNbreTotalExtension(i[0]), bg="white", width=25).grid(row=k,column=3) if (modeAdmin): Button(fextension, text="Modifier", command = rien, bg="yellow", width=13, activebackground="yellow").grid(row=k, column=6) Button(fextension, text="Supprimer", command=rien, bg="yellow", width=13, activebackground="yellow").grid(row=k, column=7) k=k+1 fextension.mainloop()