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
| # -*- coding: cp1252 -*-
from tkinter import*
nomvis1="aliment1"
nomvis2="aliment2"
nomvis3="aliment3"
police="arial",50
poids=0
valeurvis1=0
valeurvis2=0
valeurvis3=0
tare = 0
def commandevis1():
"changer l'état de la vis 1"
valeurvis1=1
fen1.destroy
def commandevis2():
""
valeurvis2=1
def commandevis3():
""
valeurvis3=1
def tarage():
""
tare=poids
fen1 = Tk()
tex1 = Label(fen1, text= str(poids) + ' kg', fg='red',font=police)
tex1.grid(row=1,column=2)
poidspartiel=str(poids-tare)
tex2 = Label(fen1, text = poidspartiel+' kg', fg='red',font=police)
tex2.grid(row=2,column=2)
boutontare = Button(fen1, text='tare', command = tarage(),font=police)
boutontare.grid(row=2,column=2)
boutonvis1 = Button(fen1, text=nomvis1, command=commandevis1)
boutonvis1.grid(row=1,column=4)
boutonvis2 = Button(fen1, text=nomvis2, command=commandevis2)
boutonvis2.grid(row=2,column=4)
boutonvis3 = Button(fen1, text=nomvis3, command=commandevis3)
boutonvis3.grid(row=3,column=4)
if valeurvis1 :
statutvis1='allumée'
else:
statutvis1=' éteinte'
Label(fen1, text=statutvis1, fg='red',font=police).grid(row=1,column=5)
if valeurvis2 :
statutvis2=' allumée'
else:
statutvis2=' éteinte'
Label(fen1, text=statutvis2, fg='red',font=police).grid(row=2,column=5)
if valeurvis2:
statutvis3=' allumée'
else:
statutvis3=' éteinte'
Label(fen1, text=statutvis3, fg='red',font=police).grid(row=3,column=5)
quit = Button(fen1, text='Quitter', command =fen1.destroy,font=police).grid(row=5,column=6)
fen1.mainloop() |
Partager