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
| from Tkinter import *
mot=''
mots=[]
toumots=[]
motinf=''
no=0
def curseur_main(e):
global fenbul
eti=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+90)+"+"+str(geoy+80))
fenbul.resizable(width=False, height=False)
fenbul.overrideredirect(1)
mes=Message(fenbul,bg='yellow',fg='black',width=500,font=('Arial', 8),text="GLACE",relief=RIDGE, aspect=001, textvariable="2.7")
mes['text']=eti.get()
mes.pack()
mot= str(mes['aspect'])+'/'+mes['text']+'/'+mes['textvariable']
def infos(e) :
global feninf,prix
prix=0
prixto=0
eti=StringVar()
feninf = Toplevel()
feninf.config(bg='lightblue')
geo1=fen1.winfo_geometry()
geox=fen1.winfo_rootx()
geoy=fen1.winfo_rooty()
feninf.geometry("300x400+"+str(geox-20)+"+"+str(geoy-30))
feninf.resizable(width=False, height=False)
feninf.title("Les articles deja commandes")
feninf.button=Button(feninf,text="ENVOYER", fg='blue',command=envoyer).pack(side=BOTTOM,pady=2)
mesinf=Message(fenbul,bg='yellow',fg='black',width=500,font=('Arial', 8),text="GLACE",relief=RIDGE, aspect=001, textvariable="2.7")
mesinf['text']=eti.get()
mesinf.pack()
motinf= str(mesinf['aspect'])+'/'+mesinf['text']+'/'+mesinf['textvariable']
prix=mesinf['textvariable']
scrolly =Scrollbar(feninf,orient=VERTICAL)
memo=Listbox(feninf,yscrollcommand=scrolly.set)
memo.pack(side=LEFT, fill=BOTH, expand=1)
scrolly.config(command=memo.yview)
scrolly.pack(side=LEFT,fill=Y)
memo.pack()
mots.append(motinf)
memo.insert(0,motinf)
fic = open('liste.txt','w')
fic = open('liste.txt','a')
fic.write("numclient:")
fic.write(str(no))
fic.write("\n")
fic.write("numarticle/article/prix")
fic.write("\n")
fic.write(motinf)
fic.write("\n")
fic.close()
print motinf
def curseur_fleche(e) :
restau_curseur()
def restau_curseur() :
global fenbul
fen1.config(cursor='arrow')
fenbul.destroy()
def ordre():
pass
def entree():
pass
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)
fenqui.grab_set()
def confir_quitter() :
fen1.destroy()
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()
print no
def envoyer():
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 reussir() :
fenenv.destroy()
feninf.destroy()
fen1 = Tk(className='Resto')
fen1.resizable(width=False,height=False)
fen1.geometry("480x320+300+200")
fram1=Frame(fen1,bg='grey',bd=2,relief='ridge')
tit0=Label(fen1, text='Resto',fg='gold',bg='blue',font=('Arial', 20))
tit0.place(x=10,y=10)
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","<Enter>",curseur_main)
can1.tag_bind("glace","<ButtonRelease>",infos)
can1.tag_bind("glace","<Leave>",curseur_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","<Enter>",curseur_main)
can2.tag_bind("cafe","<ButtonRelease>",infos)
can2.tag_bind("cafe","<Leave>",curseur_fleche)
can2.place(x=200,y=100)
n=Button(fram1, text='NUMERO', command=ordre, bg='lightblue', fg='blue')
n.place(x=10,y=50)
fermer=Button(fram1, text="VALIDER", command=quitter_prog,bg='orange', fg='brown').pack(side=BOTTOM,pady=10)
fram1.pack(side=LEFT,fill=BOTH,expand=1)
fen1.mainloop() |
Partager