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


Python ipywidgets.FloatText方法代碼示例

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


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

示例1: define_site_description_time_series

# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import FloatText [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

示例2: parameter_settings

# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import FloatText [as 別名]
def parameter_settings(eptm):
    specs = eptm.specs
    elements = []

    for element in ["edge", "vert", "face"]:
        if element not in specs:
            continue

        spec = specs[element]
        fts = []
        for param, val in spec.items():

            def update_param(change):
                specs[element][param] = change["new"]
                print(change)
                print("{} {} changed to {}".format(element, param, change["new"]))

            w = ipw.FloatText(val, description=param)
            w.observe(update_param, names="value")
            fts.append(w)
        elements.append(ipw.VBox(fts))

    return ipw.HBox(elements) 
開發者ID:DamCB,項目名稱:tyssue,代碼行數:25,代碼來源:widgets.py

示例3: calc_G_options

# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import FloatText [as 別名]
def calc_G_options(self):
        '''Widgets for method for computing soil heat flux'''

        self.w_G_form = widgets.ToggleButtons(
            description='Select method for soil heat flux',
            options={
                'Ratio of soil net radiation': 1,
                'Constant or measured value': 0,
                'Time dependent (Santanelo & Friedl)': 2},
            value=self.G_form,
            width=300)
        self.w_Gratio = widgets.BoundedFloatText(
            value=self.Gratio, min=0, max=1, description='G ratio (G/Rn)', width=80)
        self.w_Gconstant = widgets.FloatText(
            value=self.Gconstant, description='Value (W m-2)', width=80)
        self.w_Gconstant.visible = False
        self.w_Gconstanttext = widgets.HTML(
            value="Set G value (W m-2), ignored if G is present in the input file")
        self.w_Gconstanttext.visible = False
        self.w_Gconstant.visible = False
        self.w_G_amp = widgets.BoundedFloatText(
            value=self.G_amp, min=0, max=1, description='Amplitude (G/Rn)', width=80)
        self.w_G_amp.visible = False
        self.w_G_phase = widgets.BoundedFloatText(
            value=self.G_phase, min=-24, max=24, description='Time Phase (h)', width=80)
        self.w_G_phase.visible = False
        self.w_G_shape = widgets.BoundedFloatText(
            value=self.G_shape, min=0, max=24, description='Time shape (h)', width=80)
        self.w_G_shape.visible = False 
開發者ID:hectornieto,項目名稱:pyTSEB,代碼行數:31,代碼來源:TSEBIPythonInterface.py

示例4: create_widget

# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import FloatText [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

示例5: test_annotations

# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import FloatText [as 別名]
def test_annotations():
    @annotate(n=10, f=widgets.FloatText())
    def f(n, f):
        pass

    c = interactive(f)
    check_widgets(c,
        n=dict(
            cls=widgets.IntSlider,
            value=10,
        ),
        f=dict(
            cls=widgets.FloatText,
        ),
    ) 
開發者ID:luckystarufo,項目名稱:pySINDy,代碼行數:17,代碼來源:test_interaction.py

示例6: _widget

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

        if self.min is None and self.max is None:
            return ipywidgets.FloatText(value=self.value)
        else:
            return ipywidgets.BoundedFloatText(
                value=self.value,
                min=self.min or float("-inf"),
                max=self.max or float("inf"),
            ) 
開發者ID:dask,項目名稱:dask-gateway,代碼行數:13,代碼來源:options.py

示例7: create_settings

# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import FloatText [as 別名]
def create_settings(box):
    "Creates a widget Container for settings and info of a particular slider."
    _, slider, sl_units = box.children

    enable = widgets.Checkbox(value=box.visible, width="3ex")
    link((box, 'visible'), (enable, 'value'))

    def slider_link(obj, attr):
        "Function to link one object to an attr of the slider."
        # pylint: disable=unused-argument
        def link_fn(name, new_value):
            "How to update the object's value given min/max on the slider. "
            if new_value >= slider.max:
                slider.max = new_value
            # if any value is greater than the max, the max slides up
            # however, this is not held true for the minimum, because
            # during typing the max or value will grow, and we don't want
            # to permanently anchor the minimum to unfinished typing
            if attr == "max" and new_value <= slider.value:
                if slider.max >= slider.min:
                    slider.value = new_value
                else:
                    pass  # bounds nonsensical, probably because we picked up
                          # a small value during user typing.
            elif attr == "min" and new_value >= slider.value:
                slider.value = new_value
            setattr(slider, attr, new_value)
            slider.step = (slider.max - slider.min)/24.0
        obj.on_trait_change(link_fn, "value")
        link((slider, attr), (obj, "value"))

    text_html = "<span class='form-control' style='width: auto;'>"
    setvalue = widgets.FloatText(value=slider.value,
                                 description=slider.description)
    slider_link(setvalue, "value")
    fromlabel = widgets.HTML(text_html + "from")
    setmin = widgets.FloatText(value=slider.min, width="10ex")
    slider_link(setmin, "min")
    tolabel = widgets.HTML(text_html + "to")
    setmax = widgets.FloatText(value=slider.max, width="10ex")
    slider_link(setmax, "max")

    units = widgets.Label()
    units.width = "6ex"
    units.font_size = "1.165em"
    link((sl_units, 'value'), (units, 'value'))
    descr = widgets.HTML(text_html + slider.varkey.descr.get("label", ""))
    descr.width = "40ex"

    return widgets.HBox(children=[enable, setvalue, units, descr,
                                  fromlabel, setmin, tolabel, setmax],
                        width="105ex") 
開發者ID:convexengineering,項目名稱:gpkit,代碼行數:54,代碼來源:widgets.py

示例8: __init__

# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import FloatText [as 別名]
def __init__(self, paramdef):
        super(ParamSelector, self).__init__(layout=ipy.Layout(display='flex',
                                                              flex_flow='nowrap',
                                                              align_content='stretch'))

        self.paramdef = paramdef

        children = []
        self.name = ipy.HTML("<p style='text-align:right'>%s:</p>" % paramdef.displayname,
                             layout=ipy.Layout(width='200px'))
        children.append(self.name)

        if paramdef.choices:
            self.selector = ipy.Dropdown(options=paramdef.choices, **self.WIDGETKWARGS)
        elif paramdef.type == bool:
            self.selector = ipy.ToggleButtons(options=[True, False], **self.WIDGETKWARGS)
        elif paramdef.units:
            self.selector = UnitText(units=paramdef.units, **self.WIDGETKWARGS)
        elif paramdef.type == float:
            self.selector = ipy.FloatText(**self.WIDGETKWARGS)
        elif paramdef.type == int:
            self.selector = ipy.IntText(**self.WIDGETKWARGS)
        elif paramdef.type == str:
            self.selector = ipy.Text(**self.WIDGETKWARGS)
        else:
            self.selector = ReadOnlyRepr(**self.WIDGETKWARGS)
        children.append(self.selector)

        children = [self.name, self.selector]

        self.default_button = None
        if paramdef.default:
            self.default_button = ipy.Button(description='Default',
                                             tooltip='Set to default: %s' % self.paramdef.default,
                                             layout=ipy.Layout(width='75px'))
            self.default_button.on_click(self.default)
            children.append(self.default_button)
            self.default()

        self.help_link = None
        if paramdef.help_url:
            self.help_link = ipy.HTML('<a href="%s" target="_blank">?</a>' % paramdef.help_url)
            children.append(self.help_link)

        self.children = children 
開發者ID:Autodesk,項目名稱:notebook-molecular-visualization,代碼行數:47,代碼來源:configurator.py

示例9: add_widgets

# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import FloatText [as 別名]
def add_widgets(msg_instance, widget_dict, widget_list, prefix=''):
    """
    Adds widgets.

    @param msg_type The message type
    @param widget_dict The form list
    @param widget_list The widget list

    @return widget_dict and widget_list
    """
    # import only here so non ros env doesn't block installation
    from genpy import Message
    if msg_instance._type.split('/')[-1] == 'Image':
        w = widgets.Text()
        widget_dict['img'] = w
        w_box = widgets.HBox([widgets.Label(value='Image path:'), w])
        widget_list.append(w_box)
        return widget_dict, widget_list

    for idx, slot in enumerate(msg_instance.__slots__):
        attr = getattr(msg_instance, slot)
        s_t = msg_instance._slot_types[idx]
        w = None

        if s_t in ['float32', 'float64']:
            w = widgets.FloatText()
        if s_t in ['int8', 'uint8', 'int32', 'uint32', 'int64', 'uint64']:
            w = widgets.IntText()
        if s_t in ['string']:
            w = widgets.Text()

        if isinstance(attr, Message):
            widget_list.append(widgets.Label(value=slot))
            widget_dict[slot] = {}
            add_widgets(attr, widget_dict[slot], widget_list, slot)

        if w:
            widget_dict[slot] = w
            w_box = widgets.HBox([widgets.Label(value=slot, layout=widgets.Layout(width="100px")), w])
            widget_list.append(w_box)

    return widget_dict, widget_list 
開發者ID:RoboStack,項目名稱:jupyter-ros,代碼行數:44,代碼來源:ros_widgets.py

示例10: _init_widget

# 需要導入模塊: import ipywidgets [as 別名]
# 或者: from ipywidgets import FloatText [as 別名]
def _init_widget(self):
        """構建AbuPickStockPriceMinMax策略參數界麵"""

        self.description = widgets.Textarea(
            value=u'價格選股因子策略:\n'
                  u'根據交易目標的一段時間內收盤價格的最大,最小值進行選股,選中規則:\n'
                  u'1. 交易目標最小價格 > 最小價格閥值\n'
                  u'2. 交易目標最大價格 < 最大價格閥值\n',
            description=u'價格選股',
            disabled=False,
            layout=self.description_layout
        )

        self.price_min_label = widgets.Label(u'設定選股價格最小閥值,默認15', layout=self.label_layout)
        self.price_min_float = widgets.FloatText(
            value=15,
            description=u'最小:',
            disabled=False
        )
        self.price_min_ck = widgets.Checkbox(
            value=True,
            description=u'使用最小閥值',
            disabled=False
        )

        def price_min_ck_change(change):
            self.price_min_float.disabled = not change['new']

        self.price_min_ck.observe(price_min_ck_change, names='value')
        self.price_min_box = widgets.VBox([self.price_min_label, self.price_min_ck, self.price_min_float])

        self.price_max_label = widgets.Label(u'設定選股價格最大閥值,默認50', layout=self.label_layout)
        self.price_max_float = widgets.FloatText(
            value=50,
            description=u'最大:',
            disabled=False
        )
        self.price_max_ck = widgets.Checkbox(
            value=True,
            description=u'使用最大閥值',
            disabled=False
        )

        def price_max_ck_change(change):
            self.price_max_float.disabled = not change['new']

        self.price_max_ck.observe(price_max_ck_change, names='value')
        self.price_max_box = widgets.VBox([self.price_max_label, self.price_max_ck, self.price_max_float])
        self.widget = widgets.VBox([self.description, self.price_min_box, self.price_max_box,
                                    self.xd_box, self.reversed_box, self.add_box],
                                   # border='solid 1px',
                                   layout=self.widget_layout) 
開發者ID:bbfamily,項目名稱:abu,代碼行數:54,代碼來源:ABuWGPickStock.py


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