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

debut de tkinter T_T

parent f81f6580
No related branches found
No related tags found
No related merge requests found
from tkinter import *
from game_of_life.generate_universe import *
fenetre = Tk()
game_of_life = Toplevel(fenetre)
game_of_life.grid()
universe = generate_universe((100,100))
canvas = Canvas(game_of_life)
canvas.pack()
def create_a_grid():
"create the grid for the graphic interface"
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)):
zones.append([])
for y in range (len(universe[0])):
zones[x].append((x*width/100,(x+1)*width/100,y*width/100,(y+1)*width/100))
for x in range(len(universe)):
for y in range(len(universe[0])):
if universe[x][y]==1:
canvas.create_rectangle(zones[x][y],fill="black")
else:
canvas.create_rectangle(zones[x][y],fill="white")
create_a_grid()
fenetre.mainloop()
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