Skip to content
Snippets Groups Projects
Commit 36a2faf5 authored by Dolleans Geoffrey's avatar Dolleans Geoffrey
Browse files

tkinter 3/many

parent 8d1667b0
No related branches found
No related tags found
No related merge requests found
......@@ -25,9 +25,16 @@ def create_a_grid():
zones.append([])
for y in range(len(universe[0])):
if universe[x][y]==1:
zones.append(canvas.create_rectangle(x*width/100,(x+1)*width/100,y*width/100,(y+1)*width/100), fill="black")
zones[x].append(canvas.create_rectangle(x*width/100,(x+1)*width/100,y*width/100,(y+1)*width/100), fill="black")
else:
zones.append(canvas.create_rectangle(x*width/100,(x+1)*width/100,y*width/100,(y+1)*width/100, fill="white"))
zones[x].append(canvas.create_rectangle(x*width/100,(x+1)*width/100,y*width/100,(y+1)*width/100, fill="white"))
for x in range (len(universe)):
for y in range (len(universe[0])):
if universe[x][y]==1:
canvas.itemconfig(zones[x][y], fill="black")
else:
canvas.itemconfig(zones[x][y], fill="white")
def update_grid():
"""mets la grille a jours """
......@@ -37,9 +44,11 @@ def update_grid():
if universe[x][y] == 0:
if naissance([x][y]) == 1:
"colorier la case zones[x][y] en vert"
canvas.itemconfig(zones[x][y], fill="green")
else:
if survival(universe[x][y]) == 0:
"colorier la case zones[x][y] en rouge"
canvas.itemconfig(zones[x][y], fill="red")
universe = generation(universe)
def create_cell_on_click(event):
......@@ -55,7 +64,6 @@ def add_seed_tk():
global universe
type_seed = ligne_texte.get()
print(type_seed)
ligne_texte.config(text=" ")
seed = create_seed(type_seed)
"""Gestion d'exceptions"""
try:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment