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