ljvmiranda921 / seagull

A Python Library for Conway's Game of Life
https://pyseagull.readthedocs.io/en/latest/index.html#
MIT License
175 stars 28 forks source link

An animation render question #63

Open pointm opened 3 years ago

pointm commented 3 years ago

Dear developer I have coloned your Python library to "D:/seagull" in my PC , and installed the components mentioned in the README.md file . Then I opened "D:/seagull" with VSCode and add an Python file named "new_life.py" in "D:/seagull" . After that , I added the code you have showed in READMD.md like:

import seagull as sg
from seagull.lifeforms import Pulsar

board = sg.Board(size=(19,60))  

board.add(Pulsar(), loc=(1,1))
board.add(Pulsar(), loc=(1,22))
board.add(Pulsar(), loc=(1,42))

sim = sg.Simulator(board)      
sim.run(sg.rules.conway_classic, iters=1000)

sim.animate()

For showing the result , I also added the 'sim.animate' at the end of the file . But after that , when I run "D:/seagull/new_life.py" with VSCode , the terminal showed:

d:/programe_for_large/anaconda3/python.exe d:/seagull/new_life.py

2021-02-20 23:12:00.686 | INFO | seagull.simulator:compute_statistics:128 - Computing simulation statistics...

2021-02-20 23:12:00.746 | INFO | seagull.simulator:animate:183 - Rendering animation...`

And after that no window popped out , I couldn't see the same result you showed in README.md . Did I misunderstand the function of your library or anything I do wrong during my action ? Thank you so much !

balisujohn commented 2 years ago

It looks like some time has passed since this question, but I have an answer for you. You need to call plt.show() after the lines you're calling above. I think the reason plt.show() is not included in the README example is because the default assumption is that this would be run from a notebook instead of in a script directly invoked from the command line, and in the setting of a notebook, plt.show() is not required.

ljvmiranda921 commented 2 years ago

Hi @pointm sorry I wasn't able to reply for a very long time--life happened. Yes, @balisujohn's answer is the key. Thanks for replying!

pointm commented 2 years ago

Thank You Very Much(:з」∠)

mdoream commented 4 months ago

Hi

So there is still no way to run this outside of notebook? How to show the beard with animation just on the simple window?