Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update jeu_de-la-vie.py #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions jeu_de-la-vie.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding:utf-8 -*-
from tkinter import *

def finir(): #ferme la fenetre et enregistre les saisie dans les variables
def finir(): #ferme la fenetre et enregistre les saisies dans les variables
global nlignes,ncol,taille
global Entreel,Entreec,Entreet,fen1
nlignes = int(Entreel.get())
Expand Down Expand Up @@ -89,7 +89,7 @@ def nombre_de_voisins(self,rang,col) : #renvoi le nombre de voisins d'une cellul
v+=1
if self.table[rang+1][col-1]=="#" :
v+=1
elif rang != self.nr-1 and rang !=0 and col == 0 : # si dans le bord de gauche
elif rang != self.nr-1 and rang !=0 and col == 0 : #si dans le bord de gauche
if self.table[rang][col+1]=="#" :
v+=1
if self.table[rang-1][col]=="#" :
Expand All @@ -111,7 +111,7 @@ def nombre_de_voisins(self,rang,col) : #renvoi le nombre de voisins d'une cellul
v+=1
if self.table[rang-1][col-1]=="#" :
v+=1
elif rang != self.nr-1 and col == self.nc-1 and rang !=0: #si derniere collone
elif rang != self.nr-1 and col == self.nc-1 and rang !=0: #si derniere colonne
if self.table[rang][col-1]=="#" :
v+=1
if self.table[rang-1][col]=="#" :
Expand All @@ -122,7 +122,7 @@ def nombre_de_voisins(self,rang,col) : #renvoi le nombre de voisins d'une cellul
v+=1
if self.table[rang-1][col-1]=="#" :
v+=1
elif rang ==0 and col == 0 : # coin haut gauche
elif rang ==0 and col == 0 : #coin haut gauche
if self.table[rang][col+1]=="#" :
v+=1
if self.table[rang+1][col]=="#" :
Expand Down Expand Up @@ -224,7 +224,7 @@ def read(nomf) :
file=open(nomf)
li=file.readlines()
except IOError:
print("le fichier demander n'existe pas")
print("le fichier demande n'existe pas")
for l in range(len(li)) :
pair=li[l].split(',')
T.remplir(int(pair[0]),int(pair[1]))
Expand Down Expand Up @@ -286,7 +286,7 @@ def createWidgets(root):


entr =StringVar()
Entree = Entry(f1, textvariable=entr) # On définit l'objet Entry qui porte le nom Entree
Entree = Entry(f1, textvariable=entr) #On définit l'objet Entry qui porte le nom Entree
Entree["width"]=7
Entree["justify"]="center"
#Entree.pack()
Expand Down Expand Up @@ -348,4 +348,4 @@ def dest(event):
root=Tk()
createWidgets(root)
T.affiche()
root.mainloop()
root.mainloop()