Python: Draw a 2d grid and allow coloring of cells
I want to simulate the game of life problem using python. I want to draw a grid开发者_如何学Go and be able to color its cells as the simulation progresses. How do I do that in Python?
You can use pygame to do that.
To display the state of your simulation, you should create an 8 bit surface with a palette, and access it with the pygame.surfarray module.
Take a look at PyGame too.
I suggest Gloss, it's like PyGame except hardware accelerated. It also provides many other game-programming goodies.
I suggest taking a look at the Python Imaging Library (PIL) documentation
I know this is an old post, but in the name of building the perfect QA site, I would suggest matplotlib.
As of this writing, it looks like matplotlib development is getting more attention than pygame development.
精彩评论