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
|
##- 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 *
mot=''
mots=[]
no=0
total=0
dispo1=7
dispo2=7
def touche_can1(e):
global fenbul,mot1,mes1
eti1=StringVar()
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+99)+"+"+str(geoy+80))
fenbul.resizable(width=False, height=False)
fenbul.overrideredirect(1)
mes1=Message(fenbul,bg='yellow',fg='black',width=500,font=('Arial', 8),text="GLACE",relief=RIDGE, aspect=127, textvariable="2.7")
mes1['text']=eti1.get()
mes1.pack()
mot1= str(mes1['aspect'])+'/'+mes1['text']+'/'+mes1['textvariable']
def touche_can2(e):
global fenbul,mot2,mes2
eti2=StringVar()
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+199)+"+"+str(geoy+80))
fenbul.resizable(width=False, height=False)
fenbul.overrideredirect(1)
mes2=Message(fenbul,bg='yellow',fg='black',width=500,font=('Arial', 8),text="CAFE",relief=RIDGE, aspect=124, textvariable="1.2")
mes2['text']=eti2.get()
mes2.pack()
mot2= str(mes2['aspect'])+'/'+mes2['text']+'/'+mes2['textvariable']
def fleche(e) :
restau()
def restau() :
global fenbul
fen1.config(cursor='arrow')
fenbul.destroy()
def modifier():
memo.delete(0,END)
fic = open('liste.txt','a')
fic.write("******* R E C O M M E N C E R *******")
fic.write("\n")
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 demander_can1(e) :
global feninf,prix,total,dispo1
eti=StringVar()
dispo1=dispo1-1
if dispo1>=0:
prix=float(mes1['textvariable'])
total=total+prix
mots.append(mot1)
memo.insert(0,mot1)
fic = open('liste.txt','a')
fic.write("numclient:")
fic.write(str(no))
fic.write("\n")
fic.write(mot1)
fic.write("/"+str(total))
fic.write("\n")
fic.close()
print mot1,total,dispo1
else:
fenpas=Toplevel()
w = Label(fenpas, text="Il n'est plus disponible")
w.pack()
def demander_can2(e) :
global feninf,prix,total,dispo2
eti=StringVar()
dispo2=dispo2-1
if dispo2>=0:
prix=float(mes2['textvariable'])
total=total+prix
mots.append(mot2)
memo.insert(0,mot2)
fic = open('liste.txt','a')
fic.write("numclient:")
fic.write(str(no))
fic.write("\n")
fic.write(mot2)
fic.write("/"+str(total))
fic.write("\n")
fic.close()
print mot2,total,dispo2
else:
fenpas=Toplevel()
w = Label(fenpas, text="Il n'est plus disponible")
w.pack()
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)
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').pack(side=BOTTOM,padx=1)
boutonsu=Button(fram2, text="MODIFIER", command=modifier, bg='lightblue', fg='blue').pack(side=BOTTOM,padx=1)
fic = open('liste.txt','w')
fic = open('liste.txt','a')
fic.write("numero d'article/article/prix/total")
fic.write("\n")
fic.close()
can1 = Canvas(fram1, width=40, height=40)
signat1=PhotoImage(file='glace.gif')
sign1=can1.create_image(20,30, image=signat1,tag="glace")
can1.tag_bind("glace","<ButtonRelease>",demander_can1)
can1.tag_bind("glace","<Enter>",touche_can1)
can1.tag_bind("glace","<Leave>",fleche)
can1.place(x=100,y=100)
can2 = Canvas(fram1, width=40, height=40)
signat2=PhotoImage(file='cafe.gif')
sign2=can2.create_image(20,20, image=signat2,tag="cafe")
can2.tag_bind("cafe","<ButtonRelease>",demander_can2)
can2.tag_bind("cafe","<Enter>",touche_can2)
can2.tag_bind("cafe","<Leave>",fleche)
can2.place(x=200,y=100)
fen1.mainloop() |
Partager