当前位置: 首页>>代码示例>>Python>>正文


Python widgets.VBox方法代码示例

本文整理汇总了Python中ipywidgets.widgets.VBox方法的典型用法代码示例。如果您正苦于以下问题:Python widgets.VBox方法的具体用法?Python widgets.VBox怎么用?Python widgets.VBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ipywidgets.widgets的用法示例。


在下文中一共展示了widgets.VBox方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _simple_columnwise_widget

# 需要导入模块: from ipywidgets import widgets [as 别名]
# 或者: from ipywidgets.widgets import VBox [as 别名]
def _simple_columnwise_widget(ls, plot_function, columns):
    """Basic column-wise plot widget"""

    dropdown = widgets.Dropdown(options=columns, description="Column:")
    plot_area = widgets.Output()
    update_plot(plot_function, [ls, columns[0]], plot_area, height=PLOT_HEIGHT)

    dropdown.observe(
        lambda x: update_plot(
            plot_function, [ls, x["new"]], plot_area, height=PLOT_HEIGHT
        ),
        names="value",
        type="change",
    )

    return widgets.VBox([dropdown, plot_area], padding=PADDING) 
开发者ID:facultyai,项目名称:lens,代码行数:18,代码来源:widget.py

示例2: jupyter_replay

# 需要导入模块: from ipywidgets import widgets [as 别名]
# 或者: from ipywidgets.widgets import VBox [as 别名]
def jupyter_replay(self, *args, **kwargs):
        from ipywidgets import widgets
        from IPython.display import display

        try:
            sys.modules["dallinger_experiment"]._jupyter_cleanup()
        except (KeyError, AttributeError):
            pass
        replay = self.restore_state_from_replay(*args, **kwargs)
        scrubber = replay.__enter__()
        scrubber.build_widget()
        replay_widget = widgets.VBox([self.widget, scrubber.widget])
        # Scrub to start of experiment and re-render the main widget
        scrubber(self.usable_replay_range[0])
        self.widget.render()
        display(replay_widget)
        # Defer the cleanup until this function is re-called by
        # keeping a copy of the function on the experiment module
        # This allows us to effectively detect the cell being
        # re-run as there doesn't seem to be a cleanup hook for widgets
        # displayed as part of a cell that is being re-rendered

        def _jupyter_cleanup():
            replay.__exit__(None, None, None)

        sys.modules["dallinger_experiment"]._jupyter_cleanup = _jupyter_cleanup 
开发者ID:Dallinger,项目名称:Dallinger,代码行数:28,代码来源:experiment.py

示例3: create_widget

# 需要导入模块: from ipywidgets import widgets [as 别名]
# 或者: from ipywidgets.widgets import VBox [as 别名]
def create_widget(self):
        self.id_widget = widgets.HTML("")
        self.question_widget = widgets.HTML("")
        self.choice_widgets = []
        self.choice_row_list = []
        for count in range(1, 5 + 1):
            self.choice_widgets.append(widgets.HTML(""))
            self.choice_row_list.append(widgets.HBox([widgets.HTML("<b>%s</b>)&nbsp;&nbsp;" % count),
                                                      self.choice_widgets[-1]]))
        self.buttons = []
        for i in range(1, 5 + 1):
            button = widgets.Button(description = str(i))
            button.on_click(self.handle_submit)
            button.layout.margin = "20px"
            self.buttons.append(button)
        self.respond_row_widgets = widgets.HBox([widgets.HTML("""<br/><br clear="all"/><b>Respond</b>: """)] + self.buttons)
        self.next_button = widgets.Button(description="Next")
        self.next_button.on_click(self.handle_next)
        self.results_button = widgets.Button(description="Results")
        self.results_button.on_click(self.handle_results)
        self.prev_button = widgets.Button(description="Previous")
        self.prev_button.on_click(self.handle_prev)
        self.results_html = widgets.HTML("")
        self.top_margin = widgets.HTML("")
        #self.top_margin.layout.height = "100px"
        right_stack = widgets.VBox([self.top_margin, self.results_html])
        self.stack = widgets.VBox([self.id_widget, self.question_widget] + self.choice_row_list +
                                  [self.respond_row_widgets,
                                   widgets.HBox([self.prev_button, self.results_button, self.next_button])])
        self.output = widgets.Output()
        self.top_level = widgets.VBox([widgets.HBox([self.stack, right_stack]),
                                       self.output]) 
开发者ID:Calysto,项目名称:metakernel,代码行数:34,代码来源:activity_magic.py

示例4: create_pairdensity_plot_widget

# 需要导入模块: from ipywidgets import widgets [as 别名]
# 或者: from ipywidgets.widgets import VBox [as 别名]
def create_pairdensity_plot_widget(ls):
    """Create a pairwise density widget.

    Parameters
    ----------
    ls : :class:`~lens.Summary`
        Lens `Summary`.

    Returns
    -------
    :class:`ipywidgets.Widget`
        Jupyter widget to explore pairdensity plots.
    """
    numeric_columns = ls._report["column_summary"]["_columns"]
    dropdown1 = widgets.Dropdown(options=numeric_columns, description="First:")
    dropdown2 = widgets.Dropdown(
        options=numeric_columns, description="Second:"
    )
    if len(numeric_columns) > 1:
        dropdown1.value, dropdown2.value = numeric_columns[:2]

    plot_area = widgets.Output()

    for dropdown in [dropdown1, dropdown2]:
        dropdown.observe(
            lambda x: _update_pairdensity_plot(
                ls, dropdown1, dropdown2, plot_area
            ),
            names="value",
            type="change",
        )

    _update_pairdensity_plot(ls, dropdown1, dropdown2, plot_area)

    return widgets.VBox([dropdown1, dropdown2, plot_area], padding=PADDING) 
开发者ID:facultyai,项目名称:lens,代码行数:37,代码来源:widget.py


注:本文中的ipywidgets.widgets.VBox方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。