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 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385
| ##- Faire laddition
##- Sélectionner des plats
##- Connaître le nombre de couverts
##- Repérer les tables réservées
##- Voir la commande complète
##- Vérifier la disponibilité des plats
##- Dannuler, ou de modifier toute opération
from Tkinter import *
mots=[]
no=0
total=0
def touche_can1(e):
global fenbul,mot1,mes1
can1.config(cursor='hand2')
fenbul=Toplevel()
fenbul.config(bg='yellow')
geo1=fen1.winfo_geometry()
geox=fen1.winfo_rootx()
geoy=fen1.winfo_rooty()
fenbul.geometry("50x19+"+str(geox+33)+"+"+str(geoy+97))
fenbul.resizable(width=False, height=False)
fenbul.overrideredirect(1)
lab1=Label(fenbul,bg='yellow', fg='black',width=15,font=('Arial', 8),text="ENTREE",relief=RIDGE)
lab1.pack()
def touche_can2(e):
global fenbul,mot2,mes2
can2.config(cursor='hand2')
fenbul=Toplevel()
fenbul.config(bg='yellow')
geo1=fen1.winfo_geometry()
geox=fen1.winfo_rootx()
geoy=fen1.winfo_rooty()
fenbul.geometry("50x19+"+str(geox+33)+"+"+str(geoy+177))
fenbul.resizable(width=False, height=False)
fenbul.overrideredirect(1)
lab2=Label(fenbul,bg='yellow', fg='black',width=15,font=('Arial', 8),text="PLAT",relief=RIDGE)
lab2.pack()
def touche_can3(e):
global fenbul,mot3,mes3
can3.config(cursor='hand2')
fenbul=Toplevel()
fenbul.config(bg='yellow')
geo1=fen1.winfo_geometry()
geox=fen1.winfo_rootx()
geoy=fen1.winfo_rooty()
fenbul.geometry("50x19+"+str(geox+33)+"+"+str(geoy+257))
fenbul.resizable(width=False, height=False)
fenbul.overrideredirect(1)
lab3=Label(fenbul,bg='yellow', fg='black',width=15,font=('Arial', 8),text="BOISSON",relief=RIDGE)
lab3.pack()
def touche_can4(e):
global fenbul,mot4,mes4
can4.config(cursor='hand2')
fenbul=Toplevel()
fenbul.config(bg='yellow')
geo1=fen1.winfo_geometry()
geox=fen1.winfo_rootx()
geoy=fen1.winfo_rooty()
fenbul.geometry("50x19+"+str(geox+33)+"+"+str(geoy+337))
fenbul.resizable(width=False, height=False)
fenbul.overrideredirect(1)
lab4=Label(fenbul,bg='yellow', fg='black',width=15,font=('Arial', 8),text="DESSERT",relief=RIDGE)
lab4.pack()
def fleche(e) :
restau()
def restau() :
global fenbul
fen1.config(cursor='arrow')
fenbul.destroy()
def modifier():
memo.delete(0,END)
fic = open('liste.txt','w')
fic.close()
def quitter_prog() :
global fenqui
fenqui=Toplevel()
fenqui.config(bg='yellow',bd=3,relief='groove')
geo1=fen1.winfo_geometry()
geox=fen1.winfo_rootx()
geoy=fen1.winfo_rooty()
fenqui.geometry("150x60+"+str(geox+220)+"+"+str(geoy+160))
fenqui.resizable(width=False, height=False)
fenqui.overrideredirect(1)
labqui=Label(fenqui,bg='yellow',fg='red',font=('Arial', 10),text="Quitter Commande?")
labqui.place(x=17,y=1)
repon=StringVar()
bououi=Button(fenqui,text="Oui", bg='pink', fg='black',command=confir_quitter)
bounon=Button(fenqui,text="Non", bg='pink', fg='black',command=continu_prog)
bououi.place(x=20,y=25)
bounon.place(x=90,y=25)
def confir_quitter() :
fenqui.destroy()
global fenenv
fenenv=Toplevel()
geo1=fen1.winfo_geometry()
geox=fen1.winfo_rootx()
geoy=fen1.winfo_rooty()
fenenv.geometry("230x55+"+str(geox+13)+"+"+str(geoy+130))
labenv=Label(fenenv,bg='yellow',fg='blue',width=30,font=('Arial', 10),text="Les commendes sont envoyees.")
labenv.place(x=1,y=1)
bouenv=Button(fenenv,text="OK", fg='blue',command=reussir).pack(side=BOTTOM,pady=3)
def continu_prog() :
global fenqui
fenqui.destroy()
def ordre():
global ent,fenord
fenord=Toplevel()
geo1=fen1.winfo_geometry()
geox=fen1.winfo_rootx()
geoy=fen1.winfo_rooty()
fenord.geometry("217x30+"+str(geox-2)+"+"+str(geoy-85))
Label(fenord, text="NUMERO: ").grid(row=0, sticky=W)
ent = Entry(fenord)
ent.grid(row=0, column=1)
Button(fenord, text="OK", command = numeroter).grid(row = 0, column = 2)
def numeroter():
global no
no=0
no=int(ent.get())
fenord.destroy()
numero.configure(text=str(no).capitalize())
print no
def reussir() :
fenenv.destroy()
def commander_e1() :
global total
prix1=3.1
total=total + prix1
mot1='ENTR1'+ " / " + str(prix1)
mots.append(mot1)
memo.insert(0,mot1)
fic = open('liste.txt','a')
fic.write(str(no) + " / " + mot1 + " / "+str(total) + "\n")
fic.close()
print mot1,total
def commander_e2() :
global total
prix2=3.4
total=total + prix2
mot1='ENTR1'+ " / " + str(prix2)
mots.append(mot1)
memo.insert(0,mot1)
fic = open('liste.txt','a')
fic.write(str(no) + " / " + mot1 + " / "+str(total) + "\n")
fic.close()
print mot1,total
def commander_e3() :
global total
prix3=3.7
total=total + prix3
mot1='ENTR1'+ " / " + str(prix3)
mots.append(mot1)
memo.insert(0,mot1)
fic = open('liste.txt','a')
fic.write(str(no) + " / " + mot1 + " / "+str(total) + "\n")
fic.close()
print mot1,total
def commander_p1() :
global total
prix4=7.2
total=total + prix4
mot1='PLAT1'+ " / " + str(prix4)
mots.append(mot1)
memo.insert(0,mot1)
fic = open('liste.txt','a')
fic.write(str(no) + " / " + mot1 + " / "+str(total) + "\n")
fic.close()
print mot1,total
def commander_p2() :
global total
prix5=7.5
total=total + prix5
mot1='PLAT2'+ " / " + str(prix5)
mots.append(mot1)
memo.insert(0,mot1)
fic = open('liste.txt','a')
fic.write(str(no) + " / " + mot1 + " / "+str(total) + "\n")
fic.close()
print mot1,total
def commander_p3() :
global total
prix6=7.8
total=total + prix6
mot1='PLAT3'+ " / " + str(prix6)
mots.append(mot1)
memo.insert(0,mot1)
fic = open('liste.txt','a')
fic.write(str(no) + " / " + mot1 + " / "+str(total) + "\n")
fic.close()
print mot1,total
def commander_b1() :
global total
prix7=3.3
total=total + prix7
mot1='BOIS1'+ " / " + str(prix7)
mots.append(mot1)
memo.insert(0,mot1)
fic = open('liste.txt','a')
fic.write(str(no) + " / " + mot1 + " / "+str(total) + "\n")
fic.close()
print mot1,total
def commander_b2() :
global total
prix8=6.6
total=total + prix8
mot1='BOIS2'+ " / " + str(prix8)
mots.append(mot1)
memo.insert(0,mot1)
fic = open('liste.txt','a')
fic.write(str(no) + " / " + mot1 + " / "+str(total) + "\n")
fic.close()
print mot1,total
def commander_b3() :
global total
prix9=9.9
total=total + prix9
mot1='BOIS3'+ " / " + str(prix9)
mots.append(mot1)
memo.insert(0,mot1)
fic = open('liste.txt','a')
fic.write(str(no) + " / " + mot1 + " / "+str(total) + "\n")
fic.close()
print mot1,total
def commander_d1() :
global total
prix10=1.0
total=total + prix10
mot1='DESS1'+ " / " + str(prix10)
mots.append(mot1)
memo.insert(0,mot1)
fic = open('liste.txt','a')
fic.write(str(no) + " / " + mot1 + " / "+str(total) + "\n")
fic.close()
print mot1,total
def commander_d2() :
global total
prix11=3.0
total=total + prix11
mot1='DESS2'+ " / " + str(prix11)
mots.append(mot1)
memo.insert(0,mot1)
fic = open('liste.txt','a')
fic.write(str(no) + " / " + mot1 + " / "+str(total) + "\n")
fic.close()
print mot1,total
def commander_d3() :
global total
prix12=5.0
total=total + prix12
mot1='DESS3'+ " / " + str(prix12)
mots.append(mot1)
memo.insert(0,mot1)
fic = open('liste.txt','a')
fic.write(str(no) + " / " + mot1 + " / "+str(total) + "\n")
fic.close()
print mot1,total
fen1 = Tk(className='Resto')
fen1.resizable(width=False, height=False)
fen1.geometry("400x600")
fen1.iconbitmap("resto.ico")
fram1=Frame(fen1,bg='grey',bd=2,relief='ridge',width=400, height=300)
fram1.pack(fill=BOTH,expand=1)
fram2=Frame(fen1,bg='grey',bd=2,relief='ridge',width=400, height=300)
fram2.pack(fill=BOTH,expand=1)
##memo=Listbox(fram2)
##memo.pack(side=LEFT,fill=BOTH)
scrolly =Scrollbar(fram2,orient=VERTICAL)
memo = Listbox(fram2,width=31,height=12, yscrollcommand=scrolly.set, font=('Lucida Console', 9))
scrolly.config(command = memo.yview)
scrolly.pack(side=LEFT,fill=Y)
memo.pack()
boutonnu=Button(fram2, text='NUMERO', bg='lightblue', command= ordre, fg='blue')
boutonnu.place(x=320,y=2)
numero=Label(fram2,text=' ',bg='#80c0c0',font=('times',11,'bold'))
numero.place(x=377,y=2)
boutonva=Button(fram2, text="VALIDER", command=quitter_prog, bg='lightblue', fg='blue')
boutonva.place(x=235,y=188)
boutonsu=Button(fram2, text="MODIFIER", command=modifier, bg='lightblue', fg='blue')
boutonsu.place(x=125,y=188)
fic = open('liste.txt','w')
fic = open('liste.txt','a')
fic.write("numero du client/article/prix/addition")
fic.write("\n")
fic.close()
can1 = Canvas(fram1, width=50, height=50)
signat1=PhotoImage(file='entree.gif')
sign1=can1.create_image(20,30, image=signat1,tag="entree")
can1.tag_bind("entree","<Enter>",touche_can1)
can1.tag_bind("entree","<Leave>",fleche)
can1.place(x=30,y=40)
can2 = Canvas(fram1, width=50, height=50)
signat2=PhotoImage(file='plat.gif')
sign2=can2.create_image(30,30, image=signat2,tag="plat")
can2.tag_bind("plat","<Enter>",touche_can2)
can2.tag_bind("plat","<Leave>",fleche)
can2.place(x=30,y=120)
can3 = Canvas(fram1, width=50, height=50)
signat3=PhotoImage(file='boisson.gif')
sign3=can3.create_image(20,37, image=signat3,tag="boisson")
can3.tag_bind("boisson","<Enter>",touche_can3)
can3.tag_bind("boisson","<Leave>",fleche)
can3.place(x=30,y=200)
can4 = Canvas(fram1, width=50, height=50)
signat4=PhotoImage(file='dessert.gif')
sign4=can4.create_image(20,37, image=signat4,tag="dessert")
can4.tag_bind("dessert","<Enter>",touche_can4)
can4.tag_bind("dessert","<Leave>",fleche)
can4.place(x=30,y=280)
e1=Button(fram1, text='ENTR1', bg='gold', command= commander_e1, fg='blue')
e1.place(x=130,y=50)
e2=Button(fram1, text='ENTR2', bg='gold', command= commander_e2, fg='blue')
e2.place(x=190,y=50)
e3=Button(fram1, text='ENTR3', bg='gold', command= commander_e3, fg='blue')
e3.place(x=250,y=50)
p1=Button(fram1, text='PLAT1', bg='gold', command= commander_p1, fg='blue')
p1.place(x=130,y=130)
p2=Button(fram1, text='PLAT2', bg='gold', command= commander_p2, fg='blue')
p2.place(x=190,y=130)
p3=Button(fram1, text='PLAT3', bg='gold', command= commander_p3, fg='blue')
p3.place(x=250,y=130)
b1=Button(fram1, text='BOIS1', bg='gold', command= commander_b1, fg='blue')
b1.place(x=130,y=210)
b2=Button(fram1, text='BOIS2', bg='gold', command= commander_b2, fg='blue')
b2.place(x=190,y=210)
b3=Button(fram1, text='BOIS3', bg='gold', command= commander_b3, fg='blue')
b3.place(x=250,y=210)
d1=Button(fram1, text='DESS1', bg='gold', command= commander_d1, fg='blue')
d1.place(x=130,y=290)
d2=Button(fram1, text='DESS2', bg='gold', command= commander_d2, fg='blue')
d2.place(x=190,y=290)
d3=Button(fram1, text='DESS3', bg='gold', command= commander_d3, fg='blue')
d3.place(x=250,y=290)
fen1.mainloop() |