widget.py 文件源码

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

项目:altair_widgets 作者: altair-viz 项目源码 文件源码
def _create_shelf(self, i=0):
        """
        Creates shelf to plot a dimension (includes buttons
        for data column, encoding, data type, aggregate)

        """
        encodings = _get_encodings()

        cols = widgets.Dropdown(options=self.columns, description='encode')
        encoding = widgets.Dropdown(options=encodings, description='as',
                                    value=encodings[i])
        encoding.layout.width = '20%'

        adv = widgets.VBox(children=[], visible=False)

        button = widgets.Button(description='options')
        button.on_click(self._show_advanced)
        button.layout.width = '10%'

        # The callbacks when the button is clicked
        encoding.observe(self._update, names='value')
        cols.observe(self._update, names='value')

        # Making sure we know what row we're in in the callbacks
        encoding.row = cols.row = button.row = adv.row = i

        # Have the titles so we know what button we're editing
        encoding.title = 'encoding'
        cols.title = 'field'
        button.title = 'button'
        adv.title = 'advanced'

        return widgets.HBox([cols, encoding, button, adv])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号