Game of Life

17/09/2022

# Project # Game # Python

This is a Conway's Game Of Life in Python with Tkinter for school.

For the school, we were going to do Conway’s Game Of Life in Python, but the output should be in the console.

Too simple exercise, right?

Yeah! So, let’s do that with Tkinter because, why not!

Discover the Tkinter librairy

Tkinter is a standard Python interface for creating graphical interfaces.

Tkinter is quite easy to use. But, there is one thing to know. Unlike other graphics libraries, Tkinter creates objects, but does not delete them. In other words, even if your interface seems correct, it is possible that elements dating back a few frames are still present…

It is therefore important to remove all these elements with each new loop, in order to make the game more fluid. (Ahah! I had fallen into the trap of searching for hours why my code was so slow).

Writing the code

Let’s go for object-oriented programming (because it’s required).

The result

Example:

The repo:

Link on GitHub : https://github.com/pioupia/game-of-life.py/