anim3D.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:lddmm-ot 作者: jeanfeydy 项目源码 文件源码
def slider(self, div_id) :
        #div_id = self.show(*args, **kwargs)

        def change_frame(w) :
            (updates, indices) = self.get_frame(w-1)
            script = ''
            for i in range(len(updates)) :
                jupdate = json.dumps(updates[i], cls=utils.PlotlyJSONEncoder)
                #pprint(jupdate)
                script = script \
                    + 'Plotly.restyle("{id}", {update}, [{index}]);'.format(
                    id=div_id,
                    update=jupdate, index = indices[i][1:-1])
            #print(script)
            update_str = (
                ''
                '<script type="text/javascript">' +
                'window.PLOTLYENV=window.PLOTLYENV || {{}};'
                'window.PLOTLYENV.BASE_URL="' + 'https://plot.ly' + '";'
                '{script}' +
                '</script>'
                '').format(script=script)
            display(HTML(update_str))
        interact((lambda frame : change_frame(frame)), frame=(1,len(self.frames)))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号