本文整理汇总了Python中ipywidgets.FloatSlider方法的典型用法代码示例。如果您正苦于以下问题:Python ipywidgets.FloatSlider方法的具体用法?Python ipywidgets.FloatSlider怎么用?Python ipywidgets.FloatSlider使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ipywidgets
的用法示例。
在下文中一共展示了ipywidgets.FloatSlider方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_single_value_float
# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import FloatSlider [as 别名]
def test_single_value_float():
for a in (2.25, 1.0, -3.5, 0.0):
if not a:
expected_min = 0.0
expected_max = 1.0
elif a > 0:
expected_min = -a
expected_max = 3*a
else:
expected_min = 3*a
expected_max = -a
c = interactive(f, a=a)
w = c.children[0]
check_widget(w,
cls=widgets.FloatSlider,
description='a',
value=a,
min=expected_min,
max=expected_max,
step=0.1,
readout=True,
)
开发者ID:luckystarufo,项目名称:pySINDy,代码行数:24,代码来源:test_interaction.py示例2: test_defaults
# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import FloatSlider [as 别名]
def test_defaults():
@annotate(n=10)
def f(n, f=4.5, g=1):
pass
c = interactive(f)
check_widgets(c,
n=dict(
cls=widgets.IntSlider,
value=10,
),
f=dict(
cls=widgets.FloatSlider,
value=4.5,
),
g=dict(
cls=widgets.IntSlider,
value=1,
),
)
开发者ID:luckystarufo,项目名称:pySINDy,代码行数:22,代码来源:test_interaction.py示例3: test_default_out_of_bounds
# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import FloatSlider [as 别名]
def test_default_out_of_bounds():
@annotate(f=(0, 10.), h={'a': 1}, j=['hi', 'there'])
def f(f='hi', h=5, j='other'):
pass
c = interactive(f)
check_widgets(c,
f=dict(
cls=widgets.FloatSlider,
value=5.,
),
h=dict(
cls=widgets.Dropdown,
options={'a': 1},
value=1,
),
j=dict(
cls=widgets.Dropdown,
options=('hi', 'there'),
value='hi',
),
)
开发者ID:luckystarufo,项目名称:pySINDy,代码行数:24,代码来源:test_interaction.py示例4: controls_light
# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import FloatSlider [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示例5: _interact_frequency
# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import FloatSlider [as 别名]
def _interact_frequency(self,freq_val,min_freq=87.5,max_freq=108,freq_step=0.2):
'''
Sets up tuning frequency slider widget for Mono FM Example
'''
self.slider = FloatSlider(
value=freq_val,
min=min_freq,
max=max_freq,
step=freq_step,
description=r'$f_c\;$',
continuous_update=False,
orientation='horizontal',
readout_format='0.1f',
layout=Layout(
width='90%',
)
)
self.slider.style.handle_color = 'lightblue'
self.center_freq_widget = interactive(self.set_fc_mhz, fc = self.slider)
display(self.center_freq_widget)
开发者ID:mwickert,项目名称:scikit-dsp-comm,代码行数:23,代码来源:rtlsdr_helper.py示例6: _interact_audio_gain
# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import FloatSlider [as 别名]
def _interact_audio_gain(self,gain_val=0,min_gain=-60,max_gain=6,gain_step=0.1):
'''
Sets up audio gain slider widget for Mono FM Example
'''
self.gain_slider = FloatSlider(
value=gain_val,
min=min_gain,
max=max_gain,
step=gain_step,
description='Gain (dB)',
continuous_update=True,
orientation='horizontal',
readout_format='0.1f',
layout=Layout(
width='90%',
)
)
self.gain_slider.style.handle_color = 'lightgreen'
self.audio_gain_widget = interactive(self.set_audio_gain_db,gain=self.gain_slider)
display(self.audio_gain_widget)
开发者ID:mwickert,项目名称:scikit-dsp-comm,代码行数:23,代码来源:rtlsdr_helper.py示例7: __init__
# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import FloatSlider [as 别名]
def __init__(self, format=None, *args, **kwargs):
description = kwargs.pop('description', 'FloatSlider')
min = kwargs.setdefault('min', 0.0)
max = kwargs.setdefault('max', 10.0)
self.formatstring = format
self.header = ipy.HTML()
self.readout = ipy.Text(layout=ipy.Layout(width='100px'))
self.readout.on_submit(self.parse_value)
kwargs.setdefault('readout', False)
self.slider = ipy.FloatSlider(*args, **process_widget_kwargs(kwargs))
self.minlabel = ipy.HTML(u'<font size=1.5>{}</font>'.format(self.formatstring.format(min)))
self.maxlabel = ipy.HTML(u'<font size=1.5>{}</font>'.format(self.formatstring.format(max)))
self.sliderbox = HBox([self.minlabel, self.slider, self.maxlabel])
traitlets.link((self, 'description'), (self.header, 'value'))
traitlets.link((self, 'value'), (self.slider, 'value'))
self.description = description
self.update_readout()
super().__init__([self.header,
self.readout,
self.sliderbox])
开发者ID:Autodesk,项目名称:notebook-molecular-visualization,代码行数:23,代码来源:components.py示例8: interact
# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import FloatSlider [as 别名]
def interact(self):
"""Drives the interactive display of the plot explorer panels"""
param_min = self.param_vals[0]
param_max = self.param_vals[-1]
param_step = self.param_vals[1] - self.param_vals[0]
qbt_indices = [index for (index, subsystem) in self.sweep.qbt_subsys_list]
osc_indices = [index for (index, subsystem) in self.sweep.osc_subsys_list]
param_slider = ipywidgets.FloatSlider(min=param_min, max=param_max, step=param_step,
description=self.param_name, continuous_update=False)
photon_slider = ipywidgets.IntSlider(value=1, min=1, max=4, description='photon number')
initial_slider = ipywidgets.IntSlider(value=0, min=0, max=self.evals_count, description='initial state index')
final_slider = ipywidgets.IntSlider(value=1, min=1, max=self.evals_count, description='final state index')
qbt_dropdown = ipywidgets.Dropdown(options=qbt_indices, description='qubit subsys')
osc_dropdown = ipywidgets.Dropdown(options=osc_indices, description='oscillator subsys')
def update_min_final_index(*args):
final_slider.min = initial_slider.value + 1
initial_slider.observe(update_min_final_index, 'value')
out = ipywidgets.interactive_output(self.plot_explorer_panels,
{'param_val': param_slider,
'photonnumber': photon_slider,
'initial_index': initial_slider,
'final_index': final_slider,
'qbt_index': qbt_dropdown,
'osc_index': osc_dropdown
})
left_box = ipywidgets.VBox([param_slider])
mid_box = ipywidgets.VBox([initial_slider, final_slider, photon_slider])
right_box = ipywidgets.VBox([qbt_dropdown, osc_dropdown])
user_interface = ipywidgets.HBox([left_box, mid_box, right_box])
display(user_interface, out)
开发者ID:scqubits,项目名称:scqubits,代码行数:40,代码来源:explorer.py示例9: test_construction
# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import FloatSlider [as 别名]
def test_construction(self):
FloatSlider()
开发者ID:luckystarufo,项目名称:pySINDy,代码行数:4,代码来源:test_widget_float.py示例10: test_construction_readout_format
# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import FloatSlider [as 别名]
def test_construction_readout_format(self):
slider = FloatSlider(readout_format='$.1f')
assert slider.get_state()['readout_format'] == '$.1f'
开发者ID:luckystarufo,项目名称:pySINDy,代码行数:5,代码来源:test_widget_float.py示例11: test_construction_invalid_readout_format
# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import FloatSlider [as 别名]
def test_construction_invalid_readout_format(self):
with self.assertRaises(TraitError):
FloatSlider(readout_format='broken')
开发者ID:luckystarufo,项目名称:pySINDy,代码行数:5,代码来源:test_widget_float.py示例12: slider
# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import FloatSlider [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示例13: create_focus_dashboard
# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import FloatSlider [as 别名]
def create_focus_dashboard(figs, ray_data_items, foc, dfoc_rng, shift_rng,
on_axis_pt, continuous_update=True):
defocus = widgets.FloatSlider(min=-dfoc_rng, max=+dfoc_rng,
step=.01*dfoc_rng,
description='defocus', value=foc,
readout_format='.4f',
continuous_update=continuous_update)
x_shift = widgets.FloatSlider(min=-shift_rng, max=+shift_rng,
step=.01*shift_rng,
description='x shift', value=on_axis_pt[0],
readout_format='.4f',
continuous_update=continuous_update)
y_shift = widgets.FloatSlider(min=-shift_rng, max=+shift_rng,
step=.01*shift_rng,
description='y shift', value=on_axis_pt[1],
readout_format='.4f',
continuous_update=continuous_update)
def slider_update(change):
dfoc_val = defocus.value
dx = x_shift.value
dy = y_shift.value
# apply changes to fans and grids
for ray_data in ray_data_items:
ray_data.foc = dfoc_val
ray_data.image_pt_2d = np.array([dx, dy])
ray_data.update_data(build='update')
# update and plot results
for fig in figs:
fig.clf()
fig.plot()
defocus.observe(slider_update, names='value')
x_shift.observe(slider_update, names='value')
y_shift.observe(slider_update, names='value')
return defocus, x_shift, y_shift
开发者ID:mjhoptics,项目名称:ray-optics,代码行数:41,代码来源:dashboards.py示例14: _init_tip_label_with_step_x
# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import FloatSlider [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_widget
# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import FloatSlider [as 别名]
def _init_widget(self):
"""构建AbuFactorCloseAtrNStop策略参数界面"""
self.description = widgets.Textarea(
value=u'利润保护止盈策略:\n'
u'1. 买入后最大收益价格 - 今日价格 > 一定收益\n'
u'2. 买入后最大收益价格 - 今日价格 < close_atr_n * 当日atr\n'
u'3. 当买入有一定收益后,如果下跌幅度超过close_atr_n乘以当日atr->保护止盈卖出',
description=u'保护止盈',
disabled=False,
layout=self.description_layout
)
self.close_atr_n_label = widgets.Label(u'收益下跌超过close_atr_n乘以当日atr->保护止盈',
layout=self.label_layout)
self.close_atr_n = widgets.FloatSlider(
value=1.5,
min=0.10,
max=10.0,
step=0.1,
description='close_atr_n',
disabled=False,
orientation='horizontal',
readout=True,
readout_format='.1f',
)
self.close_atr_n_box = widgets.VBox([self.close_atr_n_label, self.close_atr_n])
self.widget = widgets.VBox([self.description, self.close_atr_n_box, self.add_box], # border='solid 1px',
layout=self.widget_layout)
开发者ID:bbfamily,项目名称:abu,代码行数:30,代码来源:ABuWGSellFactor.py本文标签属性:
示例:示例的拼音
代码:代码编程
Python:python怎么读