当前位置: 首页>>代码示例>>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;未经允许,请勿转载。