Conway’s Game of Life
Project using python tkinter and numpy
the main module conway contain two classes
ConWay: which handles calculations
GolGui: which handles GUI
import the module and the tkinter
import tkinter as tk
from conway import ConWay, GolGui
make instances
play = ConWay() # create a game instance
root = tk.Tk() # create the master window
gou = GolGui(root) # instance of my GUI
choose initial shapes to display
play.shapes('Beehive') # choose the shape to start with
play.shapes('Toad')
then run the main_iteration function in (trial.py)
make_iteration()
root.mainloop()
in trial.py you can find example how to use this module
-
ConWay.shape(shape)
take the shape you want to display Blinker, Toad, Glider or Beehive -
ConWay.new_screen()
Update the playground -
GolGui.draw(playground)
Draw the given numpy array
any one is welcomed to work on this code you work on any new feature or improve existing ones.
Some ideas:
- Make the user choose the initial positions by mouse