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
| from tkinter import *
import time
import PIL
from time import *
root = Tk()
root.title('Simulation de la Mini Serre')
def deplacement():
img_coords = canvas.coords(image)
img_width = img_2.width()
if img_coords[0] + img_width <= 1500:
canvas.move(image,5,0)
root.after(0,deplacement)
img = PhotoImage(file='testimg.ppm')
canvas = Canvas(root,width=1500, height=700, bg="white")
canvas.pack( side= RIGHT,padx=10,pady=10)
img_2 = img.subsample(1,1)
image=canvas.create_image(-2000,10,anchor=NW,image=img_2)
def affichage_base():
base_coords = canvas.coords(image_base)
base_width = img_base2.width()
if base_coords[0] + base_width <= 1500:
canvas.move(image_base,5,0)
root.after(0,affichage_base)
base = PhotoImage(file='H:\\ISN\\SI Programme Projet\\SERRE NEUTRE.ppm')
img_base2 =base.subsample(1,1)
image_base=canvas.create_image(-1000,10,anchor=NW,image=img_base2)
affichage_base()
def deplacement3():
img3_coords = canvas.coords(image3)
img3_width = img_3.width()
if img3_coords[0] +img3_width <= 800:
canvas.move(image3,5,0)
root.after(0,deplacement3)
img3 = PhotoImage(file='tttest.ppm')
img_3 = img3.subsample(20,20)
image3=canvas.create_image(-1000,10,anchor=NW,image=img_3)
def deplacement1():
deplacement()
deplacement3()
def fc_goutte_a_goutte():
x=1
def fc_sol_sec():
x=1
def fc_sol_humide():
x=1
pe2s = PhotoImage(file='H:\\ISN\\SI Programme Projet\\Etapes de vie des plantes\\Etapes 2 sur 5.png')
img_pe2s = pe2s.subsample(4,4)
image_pe2s1=canvas.create_image(440,412,anchor=NW,image=img_pe2s)
image_pe2s2=canvas.create_image(500,412,anchor=NW,image=img_pe2s)
image_pe2s3=canvas.create_image(560,412,anchor=NW,image=img_pe2s)
image_pe2s4=canvas.create_image(620,412,anchor=NW,image=img_pe2s)
image_pe2s5=canvas.create_image(680,412,anchor=NW,image=img_pe2s)
canvas.move(image_pe2s1,1,-800)
canvas.move(image_pe2s2,1,-800)
canvas.move(image_pe2s3,1,-800)
canvas.move(image_pe2s4,1,-800)
canvas.move(image_pe2s5,1,-800)
def fc_plante_E2_spawn():
canvas.move(image_pe2s1,-1,800)
canvas.move(image_pe2s2,-1,800)
canvas.move(image_pe2s3,-1,800)
canvas.move(image_pe2s4,-1,800)
canvas.move(image_pe2s5,-1,800)
btn_Activer_simu.configure(state='disabled')
pmj = PhotoImage(file='H:\\ISN\\SI Programme Projet\\Etapes de vie des plantes\\Plante morte jeune.png')
img_pmj = pmj.subsample(4,4)
image_pmj1=canvas.create_image(440,412,anchor=NW,image=img_pmj)
image_pmj2=canvas.create_image(500,412,anchor=NW,image=img_pmj)
image_pmj3=canvas.create_image(560,412,anchor=NW,image=img_pmj)
image_pmj4=canvas.create_image(620,412,anchor=NW,image=img_pmj)
image_pmj5=canvas.create_image(680,412,anchor=NW,image=img_pmj)
canvas.move(image_pmj1,1,-800)
canvas.move(image_pmj2,1,-800)
canvas.move(image_pmj3,1,-800)
canvas.move(image_pmj4,1,-800)
canvas.move(image_pmj5,1,-800)
def fc_plantes_E2_meurent():
canvas.move(image_pe2s1,1,-800)
canvas.move(image_pe2s2,1,-800)
canvas.move(image_pe2s3,1,-800)
canvas.move(image_pe2s4,1,-800)
canvas.move(image_pe2s5,1,-800)
btn_Activer_simu.configure(state='normal')
canvas.move(image_pmj1,-1,800)
canvas.move(image_pmj2,-1,800)
canvas.move(image_pmj3,-1,800)
canvas.move(image_pmj4,-1,800)
canvas.move(image_pmj5,-1,800)
eau = PhotoImage(file='H:\\ISN\\SI Programme Projet\\Etapes de vie des plantes\\bcp particules eau.png')
img_eau = eau.subsample(1,1)
image_eau=canvas.create_image(430,462,anchor=NW,image=img_eau)
def fc_arrosage():
eau_coords = canvas.coords(image_eau)
eau_width = img_eau.width()
eau_height =img_eau.height()
if eau_coords[0] + eau_height <= 468:
canvas.move(image_eau,0,7)
root.after(50,fc_arrosage)
fc_arrosage()
frame_2=Frame(root,height=700,width=300)
frame_2.pack(side= LEFT, anchor=N)
titre_txt=Label(frame_2, text="Mini Serre", font=('arial',20), bd=1, relief="solid", pady=20)
titre_txt.place(x=90,y=10)
btn_Activer_simu= Button(frame_2, text="Activer la simulation", fg="black", command= fc_plante_E2_spawn)
btn_Activer_simu.place(x=175,y=120)
btn_sol_sec= Button(frame_2, text="Sol Sec", fg="black", command= fc_plantes_E2_meurent)
btn_sol_sec.place(x=168,y=150)
btn_sol_humide= Button(frame_2, text="Sol Humide", fg="black", command= fc_sol_humide)
btn_sol_humide.place(x=220,y=150)
niv_humidite_txt=Label(frame_2, text="Niveau d'humidité du sol :")
niv_humidite_txt.place(x=75,y=220)
niv_humidite=Scale(frame_2,from_=50, to=0)
niv_humidite.place(x=257,y=177)
quantite_eau_txt=Label(frame_2, text="Quantité d'eau du goutte à goutte :")
quantite_eau_txt.place(x=27,y=320)
quantite_eau=Scale(frame_2,from_=50, to=0)
quantite_eau.place(x=257,y=280)
temp_serre=Scale(frame_2,from_=50, to=0)
temp_serre.place(x=257,y=385)
temp_serre_txt=Label(frame_2, text="Température de la serre :")
temp_serre_txt.place(x=80,y=420)
temp_auto_serre_txt=Label(frame_2, text="Température automatique de la serre :")
temp_auto_serre_txt.place(x=68,y=500)
temp_auto= Checkbutton(frame_2)
temp_auto.place(x=272, y=500)
gag_auto_txt=Label(frame_2, text="Activation automatique du goutte a goutte :")
gag_auto_txt.place(x=35,y=525)
gag_auto= Checkbutton(frame_2)
gag_auto.place(x=272, y=525)
root.mainloop() |