def __init__(self, t, fig, axim, tracker, occ, pt_xz, pt_zy, body, bodies,
occultors, interval = 50, gifname = None, xy = None,
quiet = False):
'''
'''
self.t = t
self.fig = fig
self.axim = axim
self.tracker = tracker
self.occ = occ
self.pt_xz = pt_xz
self.pt_zy = pt_zy
self.body = body
self.bodies = bodies
self.occultors = occultors
self.xy = xy
self.pause = True
self.animation = animation.FuncAnimation(self.fig, self.animate,
frames = 100,
interval = interval,
repeat = True)
# Save?
if gifname is not None:
self.pause = False
if not gifname.endswith('.gif'):
gifname += '.gif'
if not quiet:
print("Saving %s..." % gifname)
self.animation.save(gifname, writer = 'imagemagick',
fps = 20, dpi = 150)
self.pause = True
# Toggle button
self.axbutton = pl.axes([0.185, 0.12, 0.1, 0.03])
self.button = Button(self.axbutton, 'Play', color = 'lightgray')
self.button.on_clicked(self.toggle)
评论列表
文章目录