當前位置: 首頁>>代碼示例>>Python>>正文


Python ipywidgets.Box方法代碼示例

本文整理匯總了Python中ipywidgets.Box方法的典型用法代碼示例。如果您正苦於以下問題:Python ipywidgets.Box方法的具體用法?Python ipywidgets.Box怎麽用?Python ipywidgets.Box使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ipywidgets的用法示例。


在下文中一共展示了ipywidgets.Box方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: circuit_diagram_widget

# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import Box [as 別名]
def circuit_diagram_widget() -> wid.Box:
    """Create a circuit diagram widget.

    Returns:
        Output widget.
    """
    # The max circuit height corresponds to a 20Q circuit with flat
    # classical register.
    top_out = wid.Output(layout=wid.Layout(width='100%',
                                           height='auto',
                                           max_height='1000px',
                                           overflow='hidden scroll',))

    top = wid.Box(children=[top_out], layout=wid.Layout(width='100%', height='auto'))

    return top 
開發者ID:Qiskit,項目名稱:qiskit-terra,代碼行數:18,代碼來源:library.py

示例2: _widget

# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import Box [as 別名]
def _widget(self):
        if not hasattr(self, "_cached_widget"):
            try:
                import ipywidgets

                children = [ipywidgets.HTML("<h2>Cluster Options</h2>")]
                children.extend([f.widget() for f in self._fields.values()])
                column = ipywidgets.Box(
                    children=children,
                    layout=ipywidgets.Layout(
                        display="flex", flex_flow="column", align_items="stretch"
                    ),
                )
                widget = ipywidgets.Box(children=[column])
            except ImportError:
                widget = None
            object.__setattr__(self, "_cached_widget", widget)
        return self._cached_widget 
開發者ID:dask,項目名稱:dask-gateway,代碼行數:20,代碼來源:options.py

示例3: widget

# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import Box [as 別名]
def widget(self):
        import ipywidgets

        def handler(change):
            self.set(change.new)

        input = self._widget()
        input.observe(handler, "value")
        self._widgets.add(input)

        label = ipywidgets.HTML(
            "<p style='font-weight: bold; margin-right: 8px'>%s:</p>" % self.label
        )

        row = ipywidgets.Box(
            children=[label, input],
            layout=ipywidgets.Layout(
                display="flex", flex_flow="row wrap", justify_content="space-between"
            ),
        )

        return row 
開發者ID:dask,項目名稱:dask-gateway,代碼行數:24,代碼來源:options.py

示例4: __init__

# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import Box [as 別名]
def __init__(self):
        from .docker import DockerConfig
        from .interfaces import InterfaceStatus
        from .visualization import MdtExtensionConfig

        self.interface_status = InterfaceStatus()
        self.compute_config = DockerConfig()
        self.nbextension_config = MdtExtensionConfig()
        self.changelog = ChangeLog()
        self.tab_list = StyledTab([ipy.Box(),
                                   self.nbextension_config,
                                   self.interface_status,
                                   self.compute_config,
                                   self.changelog])
        self.tab_list.set_title(0, '^')
        self.tab_list.set_title(1, 'Notebook config')
        self.tab_list.set_title(2, "Interfaces")
        self.tab_list.set_title(3, 'Docker config')
        self.tab_list.set_title(4, "What's new")
        self.children = [self.make_header(), self.tab_list]
        super().__init__(children=self.children) 
開發者ID:Autodesk,項目名稱:notebook-molecular-visualization,代碼行數:23,代碼來源:compute.py

示例5: __init__

# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import Box [as 別名]
def __init__(self):
        self._sc = Sidecar(title='Variables')
        get_ipython().user_ns_hidden['widgets'] = widgets
        get_ipython().user_ns_hidden['NamespaceMagics'] = NamespaceMagics

        self.closed = False
        self.namespace = NamespaceMagics()
        self.namespace.shell = get_ipython().kernel.shell

        self._box = widgets.Box()
        self._box.layout.overflow_y = 'scroll'
        self._table = widgets.HTML(value='Not hooked')
        self._box.children = [self._table]

        self._ipython = get_ipython()
        self._ipython.events.register('post_run_cell', self._fill) 
開發者ID:timkpaine,項目名稱:lantern,代碼行數:18,代碼來源:variable_inspector.py

示例6: init_ui_progress

# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import Box [as 別名]
def init_ui_progress(self):
        """初始化ui進度條"""
        if not self.show_progress:
            return

        if not ABuEnv.g_is_ipython or self._total < 2:
            return

        if ABuEnv.g_main_pid == os.getpid():
            # 如果是在主進程下顯示那就直接來
            self.progress_widget = FloatProgress(value=0, min=0, max=100)
            self.text_widget = Text('pid={} begin work'.format(os.getpid()))
            self.progress_box = Box([self.text_widget, self.progress_widget])
            display(self.progress_box)
        else:
            if g_show_ui_progress and g_socket_fn is not None:
                # 子進程下通過socket通信將pid給到主進程,主進程創建ui進度條
                ABuOsUtil.socket_send_msg(g_socket_fn, '{}|init'.format(os.getpid()))

    # 不管ui進度條有什麽問題,也不能影響任務工作的進度執行,反正有文字進度會始終顯示 
開發者ID:bbfamily,項目名稱:abu,代碼行數:22,代碼來源:ABuProgress.py

示例7: __init__

# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import Box [as 別名]
def __init__(self, tool_set):
        """初始化技術分析界麵"""
        super(WidgetTLTool, self).__init__(tool_set)

        rs_box = self.init_rs_ui()
        jump_box = self.init_jump_ui()
        pair_speed = self.init_pair_speed_ui()
        shift_distance = self.init_shift_distance_ui()
        regress = self.init_regress_ui()
        golden = self.init_golden_line_ui()
        skeleton = self.init_skeleton_ui()

        children = [rs_box, jump_box, pair_speed, shift_distance, regress, golden, skeleton]
        if self.scroll_factor_box:
            tl_box = widgets.Box(children,
                                 layout=self.scroll_widget_layout)
            # 需要再套一層VBox,不然外部的tab顯示有問題
            self.widget = widgets.VBox([tl_box])
        else:
            # 一行顯示兩個,2個為一組,組裝sub_children_group序列,
            sub_children_group = self._sub_children(children, len(children) / self._sub_children_group_cnt)
            sub_children_box = [widgets.HBox(sub_children) for sub_children in sub_children_group]
            self.widget = widgets.VBox(sub_children_box) 
開發者ID:bbfamily,項目名稱:abu,代碼行數:25,代碼來源:ABuWGTLTool.py

示例8: _init_widget

# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import Box [as 別名]
def _init_widget(self):
        """構建內置的倉位資金管理可視化組件,構造出self.factor_box"""

        from ..WidgetBu.ABuWGPosition import AtrPosWidget, KellyPosWidget, PtPosition
        self.pos_array = []
        self.pos_array.append(AtrPosWidget(self))
        self.pos_array.append(KellyPosWidget(self))
        self.pos_array.append(PtPosition(self))

        #  ps() call用widget組list
        children = [pos() for pos in self.pos_array]
        if self.scroll_factor_box:
            self.factor_box = widgets.Box(children=children,
                                          layout=self.factor_layout)
        else:
            # 一行顯示兩個,n個為一組,組裝sub_children_group序列,
            sub_children_group = self._sub_children(children, len(children) / self._sub_children_group_cnt)
            sub_children_box = [widgets.HBox(sub_children) for sub_children in sub_children_group]
            self.factor_box = widgets.VBox(sub_children_box)
        # 買入因子是特殊的存在,都需要買入因子的全局數據
        self.buy_factor_manger = None 
開發者ID:bbfamily,項目名稱:abu,代碼行數:23,代碼來源:ABuWGPosBase.py

示例9: _init_widget

# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import Box [as 別名]
def _init_widget(self):
        """構建內置的賣出策略可視化組件,構造出self.factor_box"""

        from ..WidgetBu.ABuWGPickStock import PSPriceWidget, PSRegressAngWidget
        from ..WidgetBu.ABuWGPickStock import PSShiftDistanceWidget, PSNTopWidget
        self.ps_array = []
        self.ps_array.append(PSPriceWidget(self))
        self.ps_array.append(PSRegressAngWidget(self))
        self.ps_array.append(PSShiftDistanceWidget(self))
        self.ps_array.append(PSNTopWidget(self))

        #  ps() call用widget組list
        children = [ps() for ps in self.ps_array]
        if self.scroll_factor_box:
            self.factor_box = widgets.Box(children=children,
                                          layout=self.factor_layout)
        else:
            # 一行顯示兩個,3個為一組,組裝sub_children_group序列,
            sub_children_group = self._sub_children(children, len(children) / self._sub_children_group_cnt)
            sub_children_box = [widgets.HBox(sub_children) for sub_children in sub_children_group]
            self.factor_box = widgets.VBox(sub_children_box)
        # 買入因子是特殊的存在,都需要買入因子的全局數據
        self.buy_factor_manger = None 
開發者ID:bbfamily,項目名稱:abu,代碼行數:25,代碼來源:ABuWGPSBase.py

示例10: _init_widget

# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import Box [as 別名]
def _init_widget(self):
        """構建內置的買入策略可視化組件,構造出self.factor_box"""

        from ..WidgetBu.ABuWGBuyFactor import BuyDMWidget, BuyXDWidget, BuyWDWidget
        from ..WidgetBu.ABuWGBuyFactor import BuySDWidget, BuyWMWidget, BuyDUWidget

        self.bf_array = []
        self.bf_array.append(BuyDMWidget(self))
        self.bf_array.append(BuyXDWidget(self))
        self.bf_array.append(BuyWDWidget(self))
        self.bf_array.append(BuySDWidget(self))
        self.bf_array.append(BuyWMWidget(self))
        self.bf_array.append(BuyDUWidget(self))

        # bf() call用widget組list
        children = [bf() for bf in self.bf_array]

        if self.scroll_factor_box:
            self.factor_box = widgets.Box(children=children,
                                          layout=self.factor_layout)
        else:
            # 一行顯示兩個,n個為一組,組裝sub_children_group序列,
            sub_children_group = self._sub_children(children, len(children) / self._sub_children_group_cnt)
            sub_children_box = [widgets.HBox(sub_children) for sub_children in sub_children_group]
            self.factor_box = widgets.VBox(sub_children_box) 
開發者ID:bbfamily,項目名稱:abu,代碼行數:27,代碼來源:ABuWGBFBase.py

示例11: test_construction

# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import Box [as 別名]
def test_construction(self):
        box = widgets.Box()
        assert box.get_state()['children'] == [] 
開發者ID:luckystarufo,項目名稱:pySINDy,代碼行數:5,代碼來源:test_widget_box.py

示例12: test_construction_with_children

# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import Box [as 別名]
def test_construction_with_children(self):
        html = widgets.HTML('some html')
        slider = widgets.IntSlider()
        box = widgets.Box([html, slider])
        children_state = box.get_state()['children']
        assert children_state == [
            widgets.widget._widget_to_json(html, None),
            widgets.widget._widget_to_json(slider, None),
        ] 
開發者ID:luckystarufo,項目名稱:pySINDy,代碼行數:11,代碼來源:test_widget_box.py

示例13: test_construction_style

# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import Box [as 別名]
def test_construction_style(self):
        box = widgets.Box(box_style='warning')
        assert box.get_state()['box_style'] == 'warning' 
開發者ID:luckystarufo,項目名稱:pySINDy,代碼行數:5,代碼來源:test_widget_box.py

示例14: test_construction_invalid_style

# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import Box [as 別名]
def test_construction_invalid_style(self):
        with self.assertRaises(TraitError):
            widgets.Box(box_style='invalid') 
開發者ID:luckystarufo,項目名稱:pySINDy,代碼行數:5,代碼來源:test_widget_box.py

示例15: provider_buttons

# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import Box [as 別名]
def provider_buttons(providers: List[str]) -> wid.VBox:
    """Generate a collection of provider buttons for a backend.

    When one of these buttons is clicked, the code to get the particular
    provider is copied to the clipboard.

    Args:
        providers: A list of provider names.

    Returns:
        A widget with provider buttons.
    """
    vbox_buttons = []
    for pro in providers:
        button = wid.Box(children=[vue.Btn(color='#f5f5f5', small=True,
                                           children=[pro],
                                           style_="font-family: Arial,"
                                                  "sans-serif; font-size:10px;")],
                         layout=wid.Layout(margin="0px 0px 2px 0px",
                                           width='350px'))

        button.children[0].on_event('click', _copy_text)
        vbox_buttons.append(button)

    return wid.VBox(children=vbox_buttons,
                    layout=wid.Layout(width='350px',
                                      max_width='350px')) 
開發者ID:Qiskit,項目名稱:qiskit-ibmq-provider,代碼行數:29,代碼來源:provider_buttons.py


注:本文中的ipywidgets.Box方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。