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


Python ipywidgets.Label方法代码示例

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


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

示例1: progress_iterator

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

示例2: __init__

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Label [as 别名]
def __init__(self, mol):
        super().__init__(mol)

        self._atomset = collections.OrderedDict()

        self.atom_listname = ipy.Label('Selected atoms:', layout=ipy.Layout(width='100%'))
        self.atom_list = ipy.SelectMultiple(options=list(self.viewer.selected_atom_indices),
                                            layout=ipy.Layout(height='150px'))
        traitlets.directional_link(
            (self.viewer, 'selected_atom_indices'),
            (self.atom_list, 'options'),
            self._atom_indices_to_atoms
        )

        self.select_all_atoms_button = ipy.Button(description='Select all atoms')
        self.select_all_atoms_button.on_click(self.select_all_atoms)

        self.select_none = ipy.Button(description='Clear all selections')
        self.select_none.on_click(self.clear_selections)

        self.representation_buttons = ipy.ToggleButtons(options=['stick','ribbon', 'auto', 'vdw'],
                                                        value='auto')
        self.representation_buttons.observe(self._change_representation, 'value') 
开发者ID:Autodesk,项目名称:notebook-molecular-visualization,代码行数:25,代码来源:selection.py

示例3: _init_widget

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Label [as 别名]
def _init_widget(self):
        """构建AbuFactorSellBreak策略参数界面"""
        self.description = widgets.Textarea(
            value=u'海龟向下趋势突破卖出策略:\n'
                  u'趋势突破定义为当天收盘价格低于N天内的最低价,作为卖出信号,卖出操作',
            description=u'海龟卖出',
            disabled=False,
            layout=self.description_layout
        )
        self.xd_label = widgets.Label(u'突破周期参数:比如21,30,42天....突破',
                                      layout=self.label_layout)
        self.xd = widgets.IntSlider(
            value=10,
            min=3,
            max=120,
            step=1,
            description=u'周期',
            disabled=False,
            orientation='horizontal',
            readout=True,
            readout_format='d'
        )
        self.xd_box = widgets.VBox([self.xd_label, self.xd])
        self.widget = widgets.VBox([self.description, self.xd_box, self.add_box],  # border='solid 1px',
                                   layout=self.widget_layout) 
开发者ID:bbfamily,项目名称:abu,代码行数:27,代码来源:ABuWGSellFactor.py

示例4: _init_widget

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Label [as 别名]
def _init_widget(self):
        """构建AbuFactorBuyBreak策略参数界面"""

        self.description = widgets.Textarea(
            value=u'海龟向上趋势突破买入策略:\n'
                  u'趋势突破定义为当天收盘价格超过N天内的最高价,超过最高价格作为买入信号买入股票持有',
            description=u'海龟买入',
            disabled=False,
            layout=self.description_layout
        )
        self.xd_label = widgets.Label(u'突破周期参数:比如21,30,42天....突破', layout=self.label_layout)
        self.xd = widgets.IntSlider(
            value=21,
            min=3,
            max=120,
            step=1,
            description=u'周期',
            disabled=False,
            orientation='horizontal',
            readout=True,
            readout_format='d'
        )
        self.xd_box = widgets.VBox([self.xd_label, self.xd])
        self.widget = widgets.VBox([self.description, self.xd_box, self.add],  # border='solid 1px',
                                   layout=self.widget_layout) 
开发者ID:bbfamily,项目名称:abu,代码行数:27,代码来源:ABuWGBuyFactor.py

示例5: _pick_stock_base_ui

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Label [as 别名]
def _pick_stock_base_ui(self):
        """选股策略中通用ui: xd, reversed初始构建"""
        xd_tip = widgets.Label(u'设置选股策略生效周期,默认252天',
                               layout=widgets.Layout(width='300px', align_items='stretch'))
        self.xd = widgets.IntSlider(
            value=252,
            min=1,
            max=252,
            step=1,
            description=u'周期',
            disabled=False,
            orientation='horizontal',
            readout=True,
            readout_format='d'
        )
        self.xd_box = widgets.VBox([xd_tip, self.xd])

        reversed_tip = widgets.Label(u'反转选股结果,默认不反转',
                                     layout=widgets.Layout(width='300px', align_items='stretch'))
        self.reversed = widgets.Checkbox(
            value=False,
            description=u'反转结果',
            disabled=False,
        )
        self.reversed_box = widgets.VBox([reversed_tip, self.reversed]) 
开发者ID:bbfamily,项目名称:abu,代码行数:27,代码来源:ABuWGPSBase.py

示例6: subscriber_ui

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Label [as 别名]
def subscriber_ui(self, labels):
        """
        构建订阅的已添加的买入策略ui初始化
        :param labels: list序列内部对象str用来描述解释
        """
        # 添加针对指定买入策略的卖出策略
        self.accordion = widgets.Accordion()
        buy_factors_child = []
        for label in labels:
            buy_factors_child.append(widgets.Label(label,
                                                   layout=widgets.Layout(width='300px', align_items='stretch')))
        self.buy_factors = widgets.SelectMultiple(
            options=[],
            description=u'已添加的买入策略:',
            disabled=False,
            layout=widgets.Layout(width='100%', align_items='stretch')
        )
        buy_factors_child.append(self.buy_factors)
        buy_factors_box = widgets.VBox(buy_factors_child)
        self.accordion.children = [buy_factors_box] 
开发者ID:bbfamily,项目名称:abu,代码行数:22,代码来源:ABuWGBFBase.py

示例7: __init__

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Label [as 别名]
def __init__(self,
                 *,
                 max=10,
                 description='Progressing',
                 loop=None,
                 hiden=False):
        self.start_ts = monotonic()
        self.avg = 0
        self._avg_update_ts = self.start_ts
        self._ts = self.start_ts
        self._xput = deque(maxlen=self.sma_window)
        self._ProgressWidget = widgets.IntProgress(value=0,
                                                   min=0,
                                                   max=max,
                                                   step=1,
                                                   description=description,
                                                   bar_style='')
        self._elapsedTimeLabel = widgets.Label(value='Used time: 00:00:00')
        self._etaTimeLabel = widgets.Label(value='Remaining time: --:--:--')
        self.ui = widgets.HBox(
            [self._ProgressWidget, self._elapsedTimeLabel, self._etaTimeLabel])
        self.loop = asyncio.get_event_loop() if loop is None else loop
        self._update_loop = None
        self._displayed = False if not hiden else True 
开发者ID:feihoo87,项目名称:QuLab,代码行数:26,代码来源:progressbar.py

示例8: reset

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Label [as 别名]
def reset(self):
        from ipywidgets import FloatProgress, HBox, Label, Layout
        from IPython.display import display
        super(JupyterProgressRecorder, self).reset()
        self.progress_bar = FloatProgress(min=0, max=100, description='Running:')
        self.label = Label("", layout=Layout(width='100%'))
        self.box = HBox([self.progress_bar, self.label])
        display(self.box) 
开发者ID:pywr,项目名称:pywr,代码行数:10,代码来源:progress.py

示例9: __init__

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Label [as 别名]
def __init__(self, completed_len: int, visible: bool = True):
        """
        Instantiate new _Progress UI.

        Parameters
        ----------
        completed_len : int
            The expected value that indicates 100% done.
        visible : bool
            If True start the progress UI visible, by default True.

        """
        self._completed = 0
        self._total = completed_len
        self._progress = widgets.IntProgress(
            value=0,
            max=100,
            step=1,
            description="Progress:",
            bar_style="info",
            orientation="horizontal",
        )
        self._done_label = widgets.Label(value="0%")
        self._progress.visible = visible
        self._done_label.visible = visible
        self.layout = widgets.HBox([self._progress, self._done_label])
        self.display() 
开发者ID:microsoft,项目名称:msticpy,代码行数:29,代码来源:nbwidgets.py

示例10: create_widget

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Label [as 别名]
def create_widget(callback_func, init_params, image_filename=None):
    """
    Displays ipywidgets for initialization of a QuantumSystem object.

    Parameters
    ----------
    callback_func: function
        callback_function depends on all the parameters provided as keys (str) in the parameter_dict, and is called upon
        changes of values inside the widgets
    init_params: {str: value, str: value, ...}
        names and values of initialization parameters
    image_filename: str, optional
        file name for circuit image to be displayed alongside the qubit
    Returns
    -------

    """
    widgets = {}
    box_list = []
    for name, value in init_params.items():
        label = ipywidgets.Label(value=name)
        if isinstance(value, float):
            enter_widget = ipywidgets.FloatText
        else:
            enter_widget = ipywidgets.IntText

        widgets[name] = enter_widget(value=value, description='', disabled=False)
        box_list.append(ipywidgets.HBox([label, widgets[name]], layout=ipywidgets.Layout(justify_content='flex-end')))

    if image_filename:
        file = open(image_filename, "rb")
        image = file.read()
        image_widget = ipywidgets.Image(value=image, format='png', layout=ipywidgets.Layout(width='400px'))
        ui_widget = ipywidgets.HBox([ipywidgets.VBox(box_list), ipywidgets.VBox([image_widget])])
    else:
        ui_widget = ipywidgets.VBox(box_list)

    out = ipywidgets.interactive_output(callback_func, widgets)
    display(ui_widget, out) 
开发者ID:scqubits,项目名称:scqubits,代码行数:41,代码来源:qubit_widget.py

示例11: slider

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Label [as 别名]
def slider(self, value, min, max, step, description):
        label = Label(description)
        self.labels.append(label)
        ind = len(self.normals)
        button = ImageButton(
            width=36,
            height=28,
            image_path="%s/plane.png" % (self.image_path),
            tooltip="Set clipping plane",
            type=str(ind),
            layout=Layout(margin="0px 10px 0px 0px"))
        button.on_click(self.handler)
        button.add_class("view_button")

        slider = FloatSlider(
            value=value,
            min=min,
            max=max,
            step=step,
            description="",
            disabled=False,
            continuous_update=False,
            orientation='horizontal',
            readout=True,
            readout_format='.2f',
            layout=Layout(width="%dpx" % (self.width - 20)))

        slider.observe(self.cq_view.clip(ind), "value")
        return [HBox([button, label]), slider] 
开发者ID:bernhard-42,项目名称:jupyter-cadquery,代码行数:31,代码来源:cad_display.py

示例12: __init__

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Label [as 别名]
def __init__(self):
        self.client = None
        self.warning = ipy.HTML(description='<b>Engine status:</b>', value=SPINNER)
        self.devmode_label = ipy.Label('Use local docker images (developer mode)',
                                       layout=ipy.Layout(width='100%'))
        self.devmode_button = ipy.Checkbox(value=mdt.compute.config.devmode,
                                           layout=ipy.Layout(width='15px'))
        self.devmode_button.observe(self.set_devmode, 'value')

        self.engine_config_description = ipy.HTML('Docker host with protocol and port'
                                                  ' (e.g., <code>http://localhost:2375</code>).'
                                                  ' If blank, this'
                                                  ' defaults to the docker engine configured at '
                                                  'your command line.',
                                                  layout=ipy.Layout(width='100%'))
        self.engine_config_value = ipy.Text('blank', layout=ipy.Layout(width='100%'))
        self.engine_config_value.add_class('nbv-monospace')

        self.image_box = ipy.Box()

        self._reset_config_button = ipy.Button(description='Reset',
                                               tooltip='Reset to applied value')
        self._apply_changes_button = ipy.Button(description='Apply',
                                                tooltip='Apply for this session')
        self._save_changes_button = ipy.Button(description='Make default',
                                               tooltip='Make this the default for new sessions')
        self._reset_config_button.on_click(self.reset_config)
        self._apply_changes_button.on_click(self.apply_config)
        self._save_changes_button.on_click(self.save_config)

        self.children = [self.warning,
                         VBox([self.engine_config_description,
                               self.engine_config_value]),
                         HBox([self._reset_config_button,
                               self._apply_changes_button,
                               self._save_changes_button]),
                         HBox([self.devmode_button, self.devmode_label]),
                         self.image_box]
        self.reset_config()
        super().__init__(children=self.children)
        self.connect_to_engine() 
开发者ID:Autodesk,项目名称:notebook-molecular-visualization,代码行数:43,代码来源:docker.py

示例13: __init__

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Label [as 别名]
def __init__(self, tool_set):
        """初始化数据分析界面"""
        super(WidgetDATool, self).__init__(tool_set)

        da_list = []
        tip_label1 = widgets.Label(u'分析目标需要在\'分析设置\'中选择', layout=self.label_layout)
        tip_label2 = widgets.Label(u'需要设置多个分析目标进行对比', layout=self.label_layout)
        da_list.append(tip_label1)
        da_list.append(tip_label2)

        date_week_wave_bt = widgets.Button(description=u'交易日震幅对比分析', layout=widgets.Layout(width='98%'),
                                           button_style='info')
        date_week_wave_bt.on_click(self.date_week_wave)
        da_list.append(date_week_wave_bt)

        p_change_stats_bt = widgets.Button(description=u'交易日涨跌对比分析', layout=widgets.Layout(width='98%'),
                                           button_style='info')
        p_change_stats_bt.on_click(self.p_change_stats)
        da_list.append(p_change_stats_bt)

        wave_change_rate_bt = widgets.Button(description=u'振幅统计套利条件分析', layout=widgets.Layout(width='98%'),
                                             button_style='info')
        wave_change_rate_bt.on_click(self.wave_change_rate)
        da_list.append(wave_change_rate_bt)

        date_week_win_bt = widgets.Button(description=u'交易日涨跌概率分析', layout=widgets.Layout(width='98%'),
                                          button_style='info')
        date_week_win_bt.on_click(self.date_week_win)
        da_list.append(date_week_win_bt)

        bcut_change_vc_bt = widgets.Button(description=u'交易日涨跌区间分析(预定区间)', layout=widgets.Layout(width='98%'),
                                           button_style='info')
        bcut_change_vc_bt.on_click(self.bcut_change_vc)
        da_list.append(bcut_change_vc_bt)

        qcut_change_vc_bt = widgets.Button(description=u'交易日涨跌区间分析(不定区间)', layout=widgets.Layout(width='98%'),
                                           button_style='info')
        qcut_change_vc_bt.on_click(self.qcut_change_vc)
        da_list.append(qcut_change_vc_bt)

        self.widget = widgets.VBox(da_list, layout=widgets.Layout(width='58%')) 
开发者ID:bbfamily,项目名称:abu,代码行数:43,代码来源:ABuWGDATool.py

示例14: _init_tip_label_with_step_x

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Label [as 别名]
def _init_tip_label_with_step_x(self, callback_analyse, analyse_name, with_step_x=True):
        """step_x需要的地方比较多,统一构建,外部接收赋予名字"""
        if not callable(callback_analyse):
            raise TabError('callback_analyse must callable!')

        tip_label = widgets.Label(self.map_tip_target_label(n_target=1), layout=self.label_layout)
        widget_list = [tip_label]
        step_x = None
        if with_step_x:
            step_x_label = widgets.Label(u'时间步长控制参数step_x,默认1.0',
                                         layout=self.label_layout)
            step_x = widgets.FloatSlider(
                value=1.0,
                min=0.1,
                max=2.6,
                step=0.1,
                description=u'步长',
                disabled=False,
                orientation='horizontal',
                readout=True,
                readout_format='.1f',
            )
            # 返回给需要的ui,命名独有的step_x
        yield widget_list, step_x

        if with_step_x:
            # noinspection PyUnboundLocalVariable
            step_x_box = widgets.VBox([step_x_label, step_x])
            # noinspection PyTypeChecker
            widget_list.append(step_x_box)

        analyse_bt = widgets.Button(description=analyse_name, layout=widgets.Layout(width='98%'),
                                    button_style='info')
        analyse_bt.on_click(callback_analyse)
        widget_list.append(analyse_bt) 
开发者ID:bbfamily,项目名称:abu,代码行数:37,代码来源:ABuWGTLTool.py

示例15: init_golden_line_ui

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Label [as 别名]
def init_golden_line_ui(self):
        """黄金分割ui"""
        with self._init_tip_label_with_step_x(
                self._golden_line_analyse, u'黄金分割分析', with_step_x=False) as (widget_list, _):
            self.golden_line_mode = widgets.RadioButtons(
                options={u'可视化黄金分隔带': 0, u'可视化黄金分隔带+关键比例': 1,
                         u'可视化关键比例': 2},
                value=0,
                description=u'分隔模式:',
                disabled=False
            )
            widget_list.append(self.golden_line_mode)
            pt_tip_label = widgets.Label(u'比例设置仅对\'可视化关键比例\'生效', layout=self.label_layout)
            self.pt_range = widgets.FloatRangeSlider(
                value=[0.2, 0.8],
                min=0.1,
                max=0.9,
                step=0.1,
                description=u'比例设置:',
                disabled=False,
                continuous_update=False,
                orientation='horizontal',
                readout=True,
                readout_format='.1f',
            )
            pt_box = widgets.VBox([pt_tip_label, self.pt_range])
            widget_list.append(pt_box)

        return widgets.VBox(widget_list,
                            # border='solid 1px',
                            layout=self.tool_layout) 
开发者ID:bbfamily,项目名称:abu,代码行数:33,代码来源:ABuWGTLTool.py


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