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

tkinter 12/many Glorious Ca marche a vie est bell

parent 92cf04d0
No related branches found
No related tags found
No related merge requests found
......@@ -7,9 +7,9 @@ from game_of_life.Affichage_universe import *
import random as rd
fenetre = Tk()
game_of_life = Toplevel(fenetre, width= 1000, height=1000)
game_of_life = Toplevel(fenetre, width= 5000, height=5000)
game_of_life.grid()
canvas = Canvas(game_of_life)
canvas = Canvas(game_of_life, width=1000, height=1000)
canvas.pack()
var_text = StringVar
......@@ -21,8 +21,6 @@ def create_a_grid():
global universe
print("création de la grille")
universe = generate_universe((100,100))
width = game_of_life.winfo_width()
heigth = game_of_life.winfo_height()
global zones #contient l'ensemble des zones representant des cellules
zones = []
for x in range(len(universe)):
......@@ -56,23 +54,26 @@ def update_grid():
canvas.itemconfig(zones[x][y], fill="black")
universe = generation(universe)
def create_cell_on_click(event):
"""créer une cellule vivante la ou l'utilisateur clique"""
global universe
x = event.x//10
y = event.y//10
universe[x][y] = 1
update_grid()
def add_seed_tk():
"""ajoute la graine donnée dans la fenetre principale"""
print("la fonction est appelé")
global universe
type_seed = ligne_texte.get()
seed = create_seed(type_seed)
print(seed)
x_start = rd.randint(0,100-len(seed))
y_start = rd.randint(0,100-len(seed[0]))
universe= add_seed_to_universe(seed, universe, x_start, y_start)
update_grid()
button_add_seed = Button(fenetre, text="ajoute la graine",command=add_seed_tk)
......
......@@ -51,6 +51,8 @@ def create_seed(type_seed):
return seed
except KeyError:
print("Ce type de graine est inconnu")
except:
print("probleme lors de la création de la graine")
......
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