1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263
|
#/usr/local/bin/python
from tkinter import *
def choix_armoire():
global f1
f1 = Frame(fen,bg = 'grey')
f1.grid(row=1,column=0, padx=5,pady=5)
f1b1=Button(f1, text="Ajout", command=alertarmoire1)
f1b1.pack(side=TOP,padx=5,pady=5)
f1b2=Button(f1, text="Supprimer", command=alertarmoire2)
f1b2.pack(side=TOP,padx=5,pady=5)
f1.mainloop()
def choix_rayon():
global f2
f2 = Frame(fen,bg = 'grey')
f2.grid(row=1,column=2, padx=5,pady=5)
f2b1=Button(f2, text="Ajout", command=alertrayon1)
f2b1.pack(side=TOP,padx=5,pady=5)
f2b2=Button(f2, text="Supprimer", command=alertrayon2)
f2b2.pack(side=TOP,padx=5,pady=5)
f2.mainloop()
def choix_classeur():
global f3
f3 = Frame(fen,bg = 'grey')
f3.grid(row=1,column=4, padx=5,pady=5)
f3b1=Button(f3, text="Ajout", command=alertclasseur1)
f3b1.pack(side=TOP,padx=5,pady=5)
f3b2=Button(f3, text="Supprimer", command=alertclasseur2)
f3b2.pack(side=TOP,padx=5,pady=5)
f3.mainloop()
def choix_dossier():
global f4
f4 = Frame(fen,bg = 'grey')
f4.grid(row=1,column=6, padx=5,pady=5)
f4b1=Button(f4, text="Ajout", command=alertdossier1)
f4b1.pack(side=TOP,padx=5,pady=5)
f4b2=Button(f4, text="Supprimer", command=alertdossier2)
f4b2.pack(side=TOP,padx=5,pady=5)
f4.mainloop()
def choix_document():
global f5
f5 = Frame(fen,bg = 'grey')
f5.grid(row=5,column=10, padx=5,pady=5)
f5b1=Button(f5, text="Voir", command=alertdocument1)
f5b1.pack(side=TOP,padx=5,pady=5)
f5b2=Button(f5, text="Coller", command=alertdocument2)
f5b2.pack(side=TOP,padx=5,pady=5)
f5b3=Button(f5, text="Deplacer", command=alertdocument3)
f5b3.pack(side=TOP,padx=5,pady=5)
f5b4=Button(f5, text="Renommer", command=alertdocument4)
f5b4.pack(side=TOP,padx=5,pady=5)
f5b5=Button(f5, text="Supprimer", command=alertdocument5)
f5b5.pack(side=TOP,padx=5,pady=5)
f5.mainloop()
def alert():
print("alerte", "Bravo!")
def alertarmoire1():
global f1
print("alerte effacement armoire")
f1.destroy()
def alertarmoire2():
global f1
print("alerte effacement armoire")
f1.destroy()
def alertrayon1():
global f2
print("alerte effacement rayon")
f2.destroy()
def alertrayon2():
global f2
print("alerte effacement rayon")
f2.destroy()
def alertclasseur1():
global f3
print("alerte effacement classeur")
f3.destroy()
def alertclasseur2():
global f3
print("alerte effacement classeur")
f3.destroy()
def alertdossier1():
global f4
print("alerte effacement dossier")
f4.destroy()
def alertdossier2():
global f4
print("alerte effacement dossier")
f4.destroy()
def alertdocument1():
global f5
print("alerte effacement document1")
f5.destroy()
def alertdocument2():
global f5
print("alerte effacement document2")
f5.destroy()
def alertdocument3():
global f5
print("alerte effacement document3")
f5.destroy()
def alertdocument4():
global f5
print("alerte effacement document4")
f5.destroy()
def alertdocument5():
global f5
print("alerte effacement document5")
f5.destroy()
def set_list(event):
index = listboxArmoire.curselection()[0]
print(index)
print(listboxArmoire.get(index))
if __name__ == "__main__":
# fenetre principale
fen = Tk()
fen.title("GESTION ELECTRONIQUE DE DOCUMENT")
fen.geometry("1200x800")
# definition de la barre de menu
menubar = Menu(fen)
# menu fichier
menu1 = Menu(menubar, tearoff=0)
menu1.add_command(label="Créer", command=alert)
menu1.add_command(label="Editer", command=alert)
menu1.add_separator()
menu1.add_command(label="Quitter", command=fen.quit)
menubar.add_cascade(label="Fichier", menu=menu1)
# menu editer
menu2 = Menu(menubar, tearoff=0)
menu2.add_command(label="Couper", command=alert)
menu2.add_command(label="Copier", command=alert)
menu2.add_command(label="Coller", command=alert)
menubar.add_cascade(label="Editer", menu=menu2)
# menu aide
menu4 = Menu(menubar, tearoff=0)
menu4.add_command(label="A propos", command=alert)
menubar.add_cascade(label="Aide", menu=menu4)
# validation barre menu
fen.config(menu=menubar)
# definition de la structure rangement
bouton=Button(fen, text="ARMOIRE", command=choix_armoire)
bouton.grid(row=0,column=0)
bouton=Button(fen, text="RAYON", command=choix_rayon)
bouton.grid(row=0,column=2)
bouton=Button(fen, text="CLASSEUR", command=choix_classeur)
bouton.grid(row=0,column=4)
bouton=Button(fen, text="DOSSIER", command=choix_dossier)
bouton.grid(row=0,column=6)
bouton=Button(fen, text="DOCUMENT", command=choix_document)
bouton.grid(row=0,column=8)
# definition des listbox
# Armoire
listboxArmoire = Listbox(fen, width=20, height=30,
activestyle = "none",
selectbackground="#d0d0d0", selectforeground="#d00000",
selectmode="single")
listboxArmoire.grid(row=5, column=0)
yscroll = Scrollbar(command=listboxArmoire.yview, orient=VERTICAL)
yscroll.grid(row=5, column=1, sticky=N+S)
listboxArmoire.configure(yscrollcommand=yscroll.set)
listboxArmoire.grid(row=5, column=0)
listboxArmoire.bind('<Return>', set_list)
listboxArmoire.bind('<Double-1>', set_list)
# Rayon
listboxRayon = Listbox(fen, width=20, height=30,
activestyle = "none",
selectbackground="#d0d0d0", selectforeground="#d00000",
selectmode="single", cursor="hand2")
listboxRayon.grid(row=5, column=2)
yscroll = Scrollbar(command=listboxRayon.yview, orient=VERTICAL)
yscroll.grid(row=5, column=3, sticky=N+S)
listboxRayon.configure(yscrollcommand=yscroll.set)
listboxRayon.grid(row=5, column=2)
listboxRayon.bind('<Return>', set_list)
listboxRayon.bind('<Double-1>', set_list)
# Classeur
listboxClasseur = Listbox(fen, width=20, height=30,
activestyle = "none",
selectbackground="#d0d0d0", selectforeground="#d00000",
selectmode="single", cursor="hand2")
listboxClasseur.grid(row=5, column=4)
yscroll = Scrollbar(command=listboxClasseur.yview, orient=VERTICAL)
yscroll.grid(row=5, column=5, sticky=N+S)
listboxClasseur.configure(yscrollcommand=yscroll.set)
listboxClasseur.grid(row=5, column=4)
listboxClasseur.bind('<Return>', set_list)
listboxClasseur.bind('<Double-1>', set_list)
# Dossier
listboxDossier = Listbox(fen, width=20, height=30,
activestyle = "none",
selectbackground="#d0d0d0", selectforeground="#d00000",
selectmode="single", cursor="hand2")
listboxDossier.grid(row=5, column=6)
yscroll = Scrollbar(command=listboxDossier.yview, orient=VERTICAL)
yscroll.grid(row=5, column=7, sticky=N+S)
listboxDossier.configure(yscrollcommand=yscroll.set)
listboxDossier.grid(row=5, column=6)
listboxDossier.bind('<Return>', set_list)
listboxDossier.bind('<Double-1>', set_list)
# Document
listboxDocument = Listbox(fen, width=40, height=30,
activestyle = "none",
selectbackground="#d0d0d0", selectforeground="#d00000",
selectmode="single", cursor="hand2")
listboxDocument.grid(row=5, column=8)
yscroll = Scrollbar(command=listboxDocument.yview, orient=VERTICAL)
yscroll.grid(row=5, column=9, sticky=N+S)
listboxDocument.configure(yscrollcommand=yscroll.set)
listboxDocument.grid(row=5, column=8)
listboxDocument.bind('<Return>', set_list)
listboxDocument.bind('<Double-1>', set_list)
fen.mainloop() |
Partager