|
@ -140,6 +140,8 @@ class Grille: |
|
|
|
|
|
|
|
|
########Fonction interface utilisateur########### |
|
|
########Fonction interface utilisateur########### |
|
|
def bouton_grille(): |
|
|
def bouton_grille(): |
|
|
|
|
|
global f_cont |
|
|
|
|
|
f_cont=False |
|
|
grille.detruire_ancien_carre() |
|
|
grille.detruire_ancien_carre() |
|
|
grille.ligne=nb_ligne_choisi.get() |
|
|
grille.ligne=nb_ligne_choisi.get() |
|
|
grille.colonne=nb_colonne_choisi.get() |
|
|
grille.colonne=nb_colonne_choisi.get() |
|
@ -164,12 +166,18 @@ def change(event): |
|
|
grille.vivante=grille.vivante-1 |
|
|
grille.vivante=grille.vivante-1 |
|
|
grille.morte=grille.morte+1 |
|
|
grille.morte=grille.morte+1 |
|
|
zone.itemconfig(grille.lst_c[num_ligne][num_colone],fill ="white") |
|
|
zone.itemconfig(grille.lst_c[num_ligne][num_colone],fill ="white") |
|
|
|
|
|
nb_morte_lab.set("Nombre de cellule morte:"+str(grille.morte)) |
|
|
|
|
|
nb_vivante_lab.set("Nombre de cellule vivante:"+str(grille.vivante)) |
|
|
fenetre.update() |
|
|
fenetre.update() |
|
|
def taille_can(): |
|
|
def taille_can(): |
|
|
zone.config(height=new_height.get(),width=new_width.get()) |
|
|
zone.config(height=new_height.get(),width=new_width.get()) |
|
|
|
|
|
bout_soupe.config(state=NORMAL) |
|
|
|
|
|
bout_grille.config(state=NORMAL) |
|
|
|
|
|
load.config(state=NORMAL) |
|
|
|
|
|
save.config(state=NORMAL) |
|
|
def bouton_soupe(): |
|
|
def bouton_soupe(): |
|
|
|
|
|
global f_cont |
|
|
|
|
|
f_cont=False |
|
|
grille.detruire_ancien_carre() |
|
|
grille.detruire_ancien_carre() |
|
|
grille.ligne=nb_ligne_choisi.get() |
|
|
grille.ligne=nb_ligne_choisi.get() |
|
|
grille.colonne=nb_colonne_choisi.get() |
|
|
grille.colonne=nb_colonne_choisi.get() |
|
@ -189,7 +197,7 @@ def gen_cont(): |
|
|
f_cont=True |
|
|
f_cont=True |
|
|
while f_cont==True: |
|
|
while f_cont==True: |
|
|
grille.gen_suiv() |
|
|
grille.gen_suiv() |
|
|
sleep(float(vitesse.get())) |
|
|
sleep(float(vitesse.get().replace(",","."))) |
|
|
if f_cont==False: |
|
|
if f_cont==False: |
|
|
break |
|
|
break |
|
|
def stop(): |
|
|
def stop(): |
|
@ -243,9 +251,9 @@ lab_col.grid(row=2,column=3) |
|
|
choix_col=Entry(textvariable=nb_colonne_choisi,bd=5) |
|
|
choix_col=Entry(textvariable=nb_colonne_choisi,bd=5) |
|
|
choix_col.grid(row=3,column=3) |
|
|
choix_col.grid(row=3,column=3) |
|
|
|
|
|
|
|
|
bout_grille=Button(text="Créer la grille",command= bouton_grille) |
|
|
bout_grille=Button(text="Créer la grille",command= bouton_grille,state=DISABLED) |
|
|
bout_grille.grid(row=3,column=2) |
|
|
bout_grille.grid(row=3,column=2) |
|
|
bout_soupe=Button(text="Créer une soupe primordiale",command= bouton_soupe) |
|
|
bout_soupe=Button(text="Créer une soupe primordiale",command= bouton_soupe,state=DISABLED) |
|
|
bout_soupe.grid(row=2,column=2) |
|
|
bout_soupe.grid(row=2,column=2) |
|
|
|
|
|
|
|
|
new_height=IntVar() |
|
|
new_height=IntVar() |
|
@ -294,9 +302,9 @@ nb_it_lab=StringVar() |
|
|
nb_it_lab.set("Nombre d'itération:0") |
|
|
nb_it_lab.set("Nombre d'itération:0") |
|
|
lab_iteration=Label(textvariable=nb_it_lab).grid(row=2,column=9) |
|
|
lab_iteration=Label(textvariable=nb_it_lab).grid(row=2,column=9) |
|
|
################Système sauvegarde########## |
|
|
################Système sauvegarde########## |
|
|
save=Button(text="Sauvegarder",command=save) |
|
|
save=Button(text="Sauvegarder",command=save,state=DISABLED) |
|
|
save.grid(row=2,column=6) |
|
|
save.grid(row=2,column=6) |
|
|
load=Button(text="Charger",command=load) |
|
|
load=Button(text="Charger",command=load,state=DISABLED) |
|
|
load.grid(row=3,column=6) |
|
|
load.grid(row=3,column=6) |
|
|
zone.bind_all('<Button-3>', change) |
|
|
zone.bind_all('<Button-3>', change) |
|
|
|
|
|
|
|
|