seagull icon indicating copy to clipboard operation
seagull copied to clipboard

An animation render question

Open pointm opened this issue 3 years ago • 4 comments

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 !

pointm avatar Feb 20 '21 15:02 pointm

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.

balisujohn avatar Sep 30 '21 02:09 balisujohn

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!

ljvmiranda921 avatar Sep 30 '21 03:09 ljvmiranda921

Thank You Very Much_(:з」∠)_

pointm avatar Sep 30 '21 05:09 pointm

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?

mdoream avatar Mar 20 '24 15:03 mdoream