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