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


Python ipywidgets.HBox方法代码示例

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


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

示例1: add_row

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HBox [as 别名]
def add_row(self):
        newchildren = []
        for c in self.childinnotationconfigs:
            if isinstance(c, tuple) or isinstance(c, list):
                kwargs = {} if len(c) <= 2 else c[2]

                kwargs['repeat_index'] = self.rows_count
                if 'name' in kwargs:
                    kwargs['name'] = '{}_{}'.format(kwargs['name'], self.rows_count)
                newchildren.append(c[0](c[1], **kwargs))
            else:
                newchildren.append(c(self.data))

        self.rows_count += 1
        self.children_changed(newchildren)

        self.get_widget().children = tuple(list(self.get_widget().children)+[HBox([c.get_widget() for c in newchildren])])

        self.childinnotations.extend(newchildren)

        if self.max_repeats == self.rows_count:
            self.addbtn.disabled = True 
开发者ID:ideonate,项目名称:jupyter-innotater,代码行数:24,代码来源:combine.py

示例2: download_mutation_images

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HBox [as 别名]
def download_mutation_images(self):
        # TODO: dunno if this works
        import ipywidgets
        import math

        views = []
        for g in self.reference_gempro.genes:
            if g.protein.representative_structure:
                view = g.protein.view_all_mutations(alignment_type='seqalign', grouped=False, structure_opacity=0.5,
                                                    opacity_range=(0.6, 1), scale_range=(.5, 5))
                view._remote_call("setSize", target='Widget', args=['300px', '300px'])
                view.download_image(filename='{}_{}_mutations.png'.format(g.id, g.name))
                views.append(view)

        hboxes = [ipywidgets.HBox(views[i * 3:i * 3 + 3])
                  for i in range(int(math.ceil(len(views) / 3.0)))]
        vbox = ipywidgets.VBox(hboxes)
        return vbox 
开发者ID:SBRG,项目名称:ssbio,代码行数:20,代码来源:atlas.py

示例3: show_mesh

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HBox [as 别名]
def show_mesh(mesh_id, cat='car', aligned=True):
    print(mesh_id)
    mesh_fname = f'/globalwork/gross/ModelNet/ModelNet40{"Aligned" if aligned else ""}/{cat}/train/{cat}_{str(mesh_id).zfill(4)}.off'
    if not os.path.isfile(mesh_fname):
        mesh_fname = f'/globalwork/gross/ModelNet/ModelNet40{"Aligned" if aligned else ""}/{cat}/test/{cat}_{str(mesh_id).zfill(4)}.off'
    mesh = get_mesh(mesh_fname)
    mesh.apply_scale(3.)

    def on_button_next(b):
        clear_output()
        show_mesh(mesh_id + 1, cat=cat, aligned=aligned)

    def on_button_prev(b):
        clear_output()
        show_mesh(max(mesh_id - 1, 1), cat=cat, aligned=aligned)

    button_next = ipywidgets.Button(description="Next")
    button_prev = ipywidgets.Button(description="Prev")
    display(ipywidgets.HBox([button_prev, button_next]))
    button_next.on_click(on_button_next)
    button_prev.on_click(on_button_prev)
    scene = trimesh.Scene(mesh.mesh)
    viewer = scene.show(viewer='notebook')
    display(viewer)
    return scene, viewer 
开发者ID:grossjohannes,项目名称:AlignNet-3D,代码行数:27,代码来源:pointcloud.py

示例4: define_site_description_time_series

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HBox [as 别名]
def define_site_description_time_series(self):
        '''Widgets for site description parameters'''

        self.w_lat = widgets.BoundedFloatText(
            value=self.lat, min=-90, max=90, description='Lat.', width=100)
        self.w_lon = widgets.BoundedFloatText(
            value=self.lon, min=-180, max=180, description='Lon.', width=100)
        self.w_alt = widgets.FloatText(
            value=self.alt, description='Alt.', width=100)
        self.w_stdlon = widgets.BoundedFloatText(
            value=self.stdlon, min=-180, max=180, description='Std. Lon.', width=100)
        self.w_z_u = widgets.BoundedFloatText(
            value=self.zu,
            min=0.001,
            description='Wind meas. height',
            width=100)
        self.w_z_T = widgets.BoundedFloatText(
            value=self.zt, min=0.001, description='T meas. height', width=100)
        self.site_page = widgets.VBox([widgets.HBox([self.w_lat,
                                                    self.w_lon,
                                                    self.w_alt,
                                                    self.w_stdlon]),
                                      widgets.HBox([self.w_z_u,
                                                    self.w_z_T])],
                                      background_color='#EEE') 
开发者ID:hectornieto,项目名称:pyTSEB,代码行数:27,代码来源:TSEBIPythonInterface.py

示例5: spectral_properties_time_series

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HBox [as 别名]
def spectral_properties_time_series(self):
        '''Widgets for site spectral properties'''

        self.w_rho_vis_C = widgets.BoundedFloatText(
            value=self.rho_vis_C, min=0, max=1, description='Leaf refl. PAR', width=80)
        self.w_tau_vis_C = widgets.BoundedFloatText(
            value=self.tau_vis_C, min=0, max=1, description='Leaf trans. PAR', width=80)
        self.w_rho_nir_C = widgets.BoundedFloatText(
            value=self.rho_nir_C, min=0, max=1, description='Leaf refl. NIR', width=80)
        self.w_tau_nir_C = widgets.BoundedFloatText(
            value=self.tau_nir_C, min=0, max=1, description='Leaf trans. NIR', width=80)

        self.w_rho_vis_S = widgets.BoundedFloatText(
            value=self.rho_vis_S, min=0, max=1, description='Soil refl. PAR', width=80)
        self.w_rho_nir_S = widgets.BoundedFloatText(
            value=self.rho_nir_S, min=0, max=1, description='Soil refl. NIR', width=80)
        self.w_emis_C = widgets.BoundedFloatText(
            value=self.emis_C, min=0, max=1, description='Leaf emissivity', width=80)
        self.w_emis_S = widgets.BoundedFloatText(
            value=self.emis_S, min=0, max=1, description='Soil emissivity', width=80)
        self.spec_page = widgets.VBox([widgets.HBox([self.w_rho_vis_C, self.w_tau_vis_C, self.w_rho_nir_C, self.w_tau_nir_C]), widgets.HBox(
            [self.w_rho_vis_S, self.w_rho_nir_S, self.w_emis_C, self.w_emis_S])], background_color='#EEE') 
开发者ID:hectornieto,项目名称:pyTSEB,代码行数:24,代码来源:TSEBIPythonInterface.py

示例6: make_labels

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HBox [as 别名]
def make_labels():
    """Makes the labels widget.

    Returns:
        widget: The labels widget.
    """
    labels0 = widgets.HTML(value="<h5>Job ID</h5>",
                           layout=widgets.Layout(width='190px'))
    labels1 = widgets.HTML(value='<h5>Backend</h5>',
                           layout=widgets.Layout(width='145px'))
    labels2 = widgets.HTML(value='<h5>Status</h5>',
                           layout=widgets.Layout(width='95px'))
    labels3 = widgets.HTML(value='<h5>Queue</h5>',
                           layout=widgets.Layout(width='70px'))
    labels4 = widgets.HTML(value='<h5>Message</h5>')

    labels = widgets.HBox(children=[labels0, labels1, labels2, labels3, labels4],
                          layout=widgets.Layout(width='600px',
                                                margin='0px 0px 0px 37px'))
    return labels 
开发者ID:Qiskit,项目名称:qiskit-terra,代码行数:22,代码来源:job_widgets.py

示例7: show

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HBox [as 别名]
def show(self):
        box_io = widgets.HBox([self.button_save, self.button_load])
        box_control = widgets.HBox([self.button_add, self.button_replace, self.button_remove])
        display(
            widgets.VBox(
                [
                    self.button_record,
                    self.select_interpolation,
                    box_io,
                    box_control,
                    self.select_keyframes,
                    self.camera_action_box,
                    self.output,
                ]
            )
        ) 
开发者ID:maartenbreddels,项目名称:ipyvolume,代码行数:18,代码来源:moviemaker.py

示例8: controls_light

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HBox [as 别名]
def controls_light(return_widget=False):
    fig = gcf()
    ambient_coefficient = ipywidgets.FloatSlider(
        min=0, max=1, step=0.001, value=fig.ambient_coefficient, description="ambient"
    )
    diffuse_coefficient = ipywidgets.FloatSlider(
        min=0, max=1, step=0.001, value=fig.diffuse_coefficient, description="diffuse"
    )
    specular_coefficient = ipywidgets.FloatSlider(
        min=0, max=1, step=0.001, value=fig.specular_coefficient, description="specular"
    )
    specular_exponent = ipywidgets.FloatSlider(
        min=0, max=10, step=0.001, value=fig.specular_exponent, description="specular exp"
    )
    ipywidgets.jslink((fig, 'ambient_coefficient'), (ambient_coefficient, 'value'))
    ipywidgets.jslink((fig, 'diffuse_coefficient'), (diffuse_coefficient, 'value'))
    ipywidgets.jslink((fig, 'specular_coefficient'), (specular_coefficient, 'value'))
    ipywidgets.jslink((fig, 'specular_exponent'), (specular_exponent, 'value'))
    widgets_bottom = [
        ipywidgets.HBox([ambient_coefficient, diffuse_coefficient]),
        ipywidgets.HBox([specular_coefficient, specular_exponent]),
    ]
    current.container.children += tuple(widgets_bottom)
    if return_widget:
        return widgets_bottom 
开发者ID:maartenbreddels,项目名称:ipyvolume,代码行数:27,代码来源:pylab.py

示例9: progress_iterator

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HBox [as 别名]
def progress_iterator(orig_iterator, description):
    """Wrap an iterator so that a progress bar is displayed

    Parameters
    ----------
    orig_iterator: iterator
        The original iterator. It must implement the __len__ operation so that
        its length can be calculated in advance.
    description: string
        Description will give a text label for the bar.
    """
    progress_widget = FloatProgress(min=0, max=len(orig_iterator)-1)
    widget = HBox([Label(description), progress_widget])
    display(widget)
    for count, val in enumerate(orig_iterator):
        yield val
        progress_widget.value = count 
开发者ID:DavidPowell,项目名称:OpenModes,代码行数:19,代码来源:ipython.py

示例10: __init__

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HBox [as 别名]
def __init__(self):
        """IQXDashboard constructor."""
        super().__init__()

        # A list of job widgets. Each represents a job and has 5 children:
        # close button, Job ID, backend, status, and estimated start time.
        self.jobs = []  # type: List

        self._init_subscriber()
        self.dashboard = None  # type: Optional[AccordionWithThread]

        # Backend dictionary. The keys are the backend names and the values
        # are named tuples of ``IBMQBackend`` instances and a list of provider names.
        self.backend_dict = None  # type: Optional[Dict[str, BackendWithProviders]]

        # Jobs tab on the dashboard.
        self.job_viewer = None  # type: Optional[wid.VBox]
        self._clear_jobs_button = make_clear_button(self)  # type: wid.GridBox
        self._jobs_labels = make_labels()  # type: wid.HBox
        self.refresh_jobs_board() 
开发者ID:Qiskit,项目名称:qiskit-ibmq-provider,代码行数:22,代码来源:dashboard.py

示例11: make_labels

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HBox [as 别名]
def make_labels() -> widgets.HBox:
    """Makes the labels widget.

    Returns:
        The labels widget.
    """
    labels0 = widgets.HTML(value="<h5>Job ID</h5>",
                           layout=widgets.Layout(width='190px'))
    labels1 = widgets.HTML(value='<h5>Backend</h5>',
                           layout=widgets.Layout(width='165px'))
    labels2 = widgets.HTML(value='<h5>Status</h5>',
                           layout=widgets.Layout(width='125px'))
    labels3 = widgets.HTML(value='<h5>Est. Start Time</h5>',
                           layout=widgets.Layout(width='100px'))

    labels = widgets.HBox(children=[labels0, labels1, labels2, labels3],
                          layout=widgets.Layout(width='700px',
                                                margin='0px 0px 0px 35px'))
    return labels 
开发者ID:Qiskit,项目名称:qiskit-ibmq-provider,代码行数:21,代码来源:job_widgets.py

示例12: _widgets

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HBox [as 别名]
def _widgets(self):
        dfrange = self.varr.range('frame')
        w_frame = iwgt.IntSlider(
            value=0,
            min=dfrange[0],
            max=dfrange[1],
            continuous_update=False,
            description="Frame:")
        w_paly = iwgt.Play(
            value=0,
            min=dfrange[0],
            max=dfrange[1],
            interval=1000 / self.framerate)
        iwgt.jslink((w_paly, 'value'), (w_frame, 'value'))
        iwgt.interactive(self.stream.event, f=w_frame)
        return iwgt.HBox([w_paly, w_frame]) 
开发者ID:DeniseCaiLab,项目名称:minian,代码行数:18,代码来源:visualization.py

示例13: _widgets

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HBox [as 别名]
def _widgets(self):
        dfrange = self.ds.range('frame')
        w_frame = iwgt.IntSlider(
            value=0,
            min=dfrange[0],
            max=dfrange[1],
            continuous_update=False,
            description="Frame:")
        w_paly = iwgt.Play(
            value=0,
            min=dfrange[0],
            max=dfrange[1],
            interval=1000 / self.framerate)
        iwgt.jslink((w_paly, 'value'), (w_frame, 'value'))
        iwgt.interactive(self.stream.event, f=w_frame)
        return iwgt.HBox([w_paly, w_frame]) 
开发者ID:DeniseCaiLab,项目名称:minian,代码行数:18,代码来源:visualization_ply.py

示例14: __init__

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HBox [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

示例15: _init_widget

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HBox [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


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