當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。