peakfinder2D_gui.py 文件源码

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

项目:pyxem 作者: pyxem 项目源码 文件源码
def create_navigator_1d(self):
        import ipywidgets as ipyw
        x_min, x_max = 0, self.signal.axes_manager.navigation_size - 1
        x_text = ipyw.BoundedIntText(value=self.indices[0],
                                     description="Coordinate", min=x_min,
                                     max=x_max,
                                     layout=ipyw.Layout(flex='0 1 auto',
                                                        width='auto'))
        randomize = ipyw.Button(description="Randomize",
                                layout=ipyw.Layout(flex='0 1 auto',
                                                   width='auto'))
        container = ipyw.HBox((x_text, randomize))

        def on_index_change(change):
            self.indices = (x_text.value,)
            self.replot_image()

        def on_randomize(change):
            from random import randint
            x = randint(x_min, x_max)
            x_text.value = x

        x_text.observe(on_index_change, names='value')
        randomize.on_click(on_randomize)
        return container
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号