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
| from Tkinter import*
root=Tk()
def Valid(event):
L=[]
v=e1.get()
L.append(v+'/')
e1.delete(0,END)
print L
Ouvre(L)
Memoire(L,'a')
ChangeLabText()
def Voir():
f=open('mem.txt','r')
lire=f.readlines()
print lire
f.close()
def Ouvre(L):
f=open("mem.txt",'a')
f.writelines(L)
f.close()
def Memoire(L,mode):
if L!="":
Long=len(L)
LL=str(Long)
elif L=="":
LL=""
f=open("Resti.txt",mode)
f.writelines(LL)
f.close()
def ChangeLabText(L):
f=open("Resti.txt",'r')
LectDon=f.readline()
if LectDon=='1':
lb1.config(text="Designation")
elif LectDon=='11':
lb1.config(text="Quantite")
elif LectDon=='111':
lb1.config(text="Semaine")
elif LectDon=='1111':
LectDon=""
Memoire(LectDon,'w')
e1.configure(state=DISABLED)
lb1.config(text='FIN')
f.close()
#widget entrer
e1=Entry(root)
e1.focus_set()
e1.bind("<Return>", Valid)
#widget label
lb1=Label(root,text="Numero off",fg='blue',font=("Helvetica",14))
b1=Button(root,text="Voir",command=Voir)
lb1.pack()
e1.pack()
b1.pack()
mainloop() |