本文整理汇总了Python中ipywidgets.Select方法的典型用法代码示例。如果您正苦于以下问题:Python ipywidgets.Select方法的具体用法?Python ipywidgets.Select怎么用?Python ipywidgets.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ipywidgets
的用法示例。
在下文中一共展示了ipywidgets.Select方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_widget
# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Select [as 别名]
def _create_widget(self):
if self.dropdown:
return Dropdown(options=self.classes, layout=self.layout, disabled=self.disabled)
return Select(options=self.classes, layout=self.layout, disabled=self.disabled)
示例2: _select_alert
# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Select [as 别名]
def _select_alert(self, selection=None):
"""Select action triggered by picking item from list."""
if (
selection is None
or "new" not in selection
or not isinstance(selection["new"], str)
):
self.selected_alert = None
else:
self.alert_id = selection["new"]
self.selected_alert = self._get_alert(self.alert_id)
if self.alert_action is not None:
self._run_action()
示例3: _select_top_alert
# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Select [as 别名]
def _select_top_alert(self):
"""Select the first alert by default."""
top_alert = self.alerts.iloc[0]
if not top_alert.empty:
self.alert_id = top_alert.SystemAlertId
self.selected_alert = self._get_alert(self.alert_id)
if self.alert_action is not None:
self._run_action()
示例4: create_widgets
# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Select [as 别名]
def create_widgets(self):
"""
Returns:
"""
select = widgets.Select # Multiple
self.w_group = select(description="Groups:")
self.w_node = select(description="Nodes:")
self.w_file = select(description="Files:")
self.w_text = widgets.HTML()
# self.w_text = widgets.Textarea()
self.w_text.layout.height = "330px"
self.w_text.layout.width = "580px"
self.w_text.disabled = True
# self.w_plot = self.fig
w_list = widgets.VBox([self.w_group, self.w_node, self.w_file])
self.w_tab = widgets.HBox([w_list, self.w_text])
# tab = widgets.Tab(children=[self.w_group, self.w_node, self.w_file, self.w_text])
# [tab.set_title(num, name) for num, name in enumerate(['groups', 'nodes', 'files', 'text'])]
# self.w_tab = tab
self.w_path = widgets.Text(name="Path: ")
self.w_path.layout.width = "680px"
self.w_type = widgets.Text(name="Type: ")
self.refresh_view()
示例5: test_construction
# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Select [as 别名]
def test_construction(self):
select = Select(options=['a', 'b', 'c'])
示例6: test_index_trigger
# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Select [as 别名]
def test_index_trigger(self):
select = Select(options=[1, 2, 3])
observations = []
def f(change):
observations.append(change.new)
select.observe(f, 'index')
assert select.index == 0
select.options = [4, 5, 6]
assert select.index == 0
assert select.value == 4
assert select.label == '4'
assert observations == [0]
示例7: __init__
# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Select [as 别名]
def __init__(self):
self.ch = bioservices.ChEBI()
self.kegg = bioservices.KEGG()
self.wOntologySelect = w.Dropdown(description='Ontology:', options=['ChEBI', 'KEGG.Reaction'])
self.wSearchTerm = w.Text(description='Search Term:', value="glucose")
self.wSearchTerm.on_submit(self.search)
self.wSearchButton = w.Button(description='Search')
self.wSearchButton.on_click(self.search)
self.wResultsSelect = w.Select(description='Results:', width='100%')
self.wResultsSelect.on_trait_change(self.selectedTerm)
self.wResultsURL = w.Textarea(description='URL:', width='100%')
self.wResults = w.VBox(children=[
self.wResultsSelect,
self.wResultsURL
], width='100%')
for ch in self.wResults.children:
ch.font_family = 'monospace'
ch.color = '#AAAAAA'
ch.background_color = 'black'
# <Container>
self.wContainer = w.VBox([
self.wOntologySelect,
self.wSearchTerm,
self.wSearchButton,
self.wResults
])
# display the container
display(self.wContainer)
self.init_display()
示例8: __init__
# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Select [as 别名]
def __init__(self, errormessages, molin, molout=None):
self.molin = molin
self.molout = molout
self.msg = errormessages
self.status = ipy.HTML('<h4>Forcefield assignment: %s</h4>' %
('Success' if molout else 'FAILED'))
self.listdesc = ipy.HTML('<b>Errors / warnings:</b>')
error_display = collections.OrderedDict((e.short, e) for e in self.msg)
if len(error_display) == 0:
error_display['No errors or warnings.'] = StructureOk()
self.errorlist = ipy.Select(options=error_display)
self.errmsg = ipy.HTML('-')
self.viewer = self.molin.draw3d()
self.viewer.ribbon(opacity=0.7)
if self.errorlist.value is not None:
self.switch_display({'old': self.errorlist.value, 'new': self.errorlist.value})
self.errorlist.observe(self.switch_display, 'value')
children = (self.status,
HBox([self.viewer, VBox([self.listdesc, self.errorlist])]),
self.errmsg)
super().__init__(children=children, layout=ipy.Layout(display='flex', flex_flow='column'))
示例9: _init_manager_ui
# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Select [as 别名]
def _init_manager_ui(self):
"""裁判数据管理界面初始化"""
description = widgets.Textarea(
value=u'删除选择的裁判本地数据:\n'
u'删除所选择的已训练好的本地裁判数据,谨慎操作!\n'
u'分享选择的裁判:\n'
u'将训练好的裁判数据分享到交易社区,供其他交易者使用\n'
u'下载更多的裁判:\n'
u'从交易社区,下载更多训练好的裁判数据\n',
disabled=False,
layout=widgets.Layout(height='150px')
)
self.manager_umps = widgets.Select(
options=[],
description=u'本地裁判:',
disabled=False,
layout=widgets.Layout(width='100%', align_items='stretch')
)
self.load_train_ump(self.manager_umps)
delete_bt = widgets.Button(description=u'删除选择的裁判本地数据', layout=widgets.Layout(width='98%'),
button_style='warning')
delete_bt.on_click(self._do_delete_ump)
share_bt = widgets.Button(description=u'分享选择的裁判', layout=widgets.Layout(width='98%'),
button_style='info')
share_bt.on_click(permission_denied)
down_bt = widgets.Button(description=u'下载更多的裁判', layout=widgets.Layout(width='98%'),
button_style='info')
down_bt.on_click(permission_denied)
return widgets.VBox([description, self.manager_umps, delete_bt, share_bt, down_bt])
示例10: _init_train_ui
# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Select [as 别名]
def _init_train_ui(self):
"""裁判特征训练面初始化"""
description = widgets.Textarea(
value=u'裁判特征训练:\n'
u'通过在\'裁判特征采集\'选中\'回测过程生成交易特征\'可在回测完成后保存当此回测结果\n'
u'所有回测的结果将显示在下面的\'备选回测:\'框中\n'
u'通过\'开始训练裁判\'进行指定的回测裁判训练,训练后的裁判在\'裁判预测拦截\'下可进行选择,选中的裁判将在对应的'
u'回测中生效,即开始在回测中对交易进行预测拦截等智能交易干涉行为',
disabled=False,
layout=widgets.Layout(height='150px')
)
self.abu_result = widgets.Select(
options=[],
description=u'备选回测:',
disabled=False,
layout=widgets.Layout(width='100%', align_items='stretch')
)
self.load_abu_result()
train_bt = widgets.Button(description=u'开始训练裁判', layout=widgets.Layout(width='98%'),
button_style='info')
train_bt.on_click(self._do_train)
delete_bt = widgets.Button(description=u'删除选择的备选回测本地数据', layout=widgets.Layout(width='98%'),
button_style='warning')
delete_bt.on_click(self._do_delete_abu_result)
return widgets.VBox([description, self.abu_result, train_bt, delete_bt])
示例11: __init__
# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Select [as 别名]
def __init__(
self,
default: int = 4,
label: str = "Select time ({units}) to look back",
origin_time: datetime = None,
min_value: int = 1,
max_value: int = 240,
units: str = "hour",
auto_display: bool = False,
):
"""
Create an instance of the lookback slider widget.
Parameters
----------
default : int, optional
The default 'lookback' time (the default is 4)
label : str, optional
The description to display
(the default is 'Select time ({units}) to look back')
origin_time : datetime, optional
The origin time (the default is `datetime.utcnow()`)
min_value : int, optional
Minimum value (the default is 1)
max_value : int, optional
Maximum value (the default is 240)
units : str, optional
Time unit (the default is 'hour')
Permissable values are 'day', 'hour', 'minute', 'second'
These can all be abbreviated down to initial characters
('d', 'm', etc.)
auto_display : bool, optional
Whether to display on instantiation (the default is False)
"""
# default to now
self.origin_time = datetime.utcnow() if origin_time is None else origin_time
self._time_unit = _parse_time_unit(units)
if "{units}" in label:
label = label.format(units=self._time_unit.name)
self._lookback_wgt = widgets.IntSlider(
value=default,
min=min_value,
max=max_value,
step=1,
description=label,
layout=Layout(width="60%", height="50px"),
style={"description_width": "initial"},
)
self.end = self.origin_time
self._time_unit = _parse_time_unit(units)
self.start = self.end - timedelta(
seconds=(self._time_unit.value * self._lookback_wgt.value)
)
self._lookback_wgt.observe(self._time_range_change, names="value")
if auto_display:
self.display()
示例12: __init__
# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Select [as 别名]
def __init__(self, debug=False):
""" Creates and displays the search form. """
self.debug = debug
self.s = bioservices.BioModels()
self.ch = bioservices.ChEBI()
# Define widgets
# <Search>
self.wSearchTerm = w.Text(description='Search biomodels by species:', value="CHEBI:17925")
self.wSearchTerm.on_submit(self.searchChebi)
self.wSearchButton = w.Button(description='Search')
self.wSearchButton.on_click(self.searchChebi)
self.wSearchChebi = w.HBox(children=[
self.wSearchTerm, self.wSearchButton
])
self.wSelectChebis = w.Select(description='Matching ChEBI:', width='600px', height='250px')
# FIXME: update the deprecated functions
self.wSelectChebis.on_trait_change(self.selectChebi)
self.wSelectModels = w.Select(description='Matching BioModels:', width='200px')
self.wSelectModels.on_trait_change(self.selectedModel)
# <Model>
self.wModelId = w.Text(description='Model ID:', value="No model selected")
self.wModelCode = w.Text(description='Install Code:')
self.wModelImport = w.Text(description='Import module code:')
self.wModelSbml = w.Textarea(description='Model SBML:', width='800px', height='300px')
# <Container>
self.wModel = w.VBox([
self.wModelId,
self.wModelCode,
self.wSelectModels,
self.wModelImport,
self.wModelSbml
])
for ch in self.wModel.children:
ch.font_family = 'monospace'
ch.color = '#AAAAAA'
ch.background_color = 'black'
self.wContainer = w.VBox([
self.wSearchChebi,
self.wSelectChebis,
self.wModel
])
# display the widgets
display(self.wContainer)
示例13: __init__
# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Select [as 别名]
def __init__(self, mol):
self._current_shapes = []
self.mol = mol
self.tolerance = 0.3 * u.angstrom
self.original_coords = mol.positions.copy()
self.showing = ipy.HTML()
self.viewer = mol.draw3d(width='650px')
""":type viewer: moldesign.viewer.GeometryViewer"""
self.description = ipy.HTML()
self.symm_selector = ipy.Select()
self.symm_selector.observe(self.show_symmetry, names='value')
self.apply_button = ipy.Button(description='Symmetrize')
self.apply_button.on_click(self.apply_selected_symmetry)
self.reset_button = ipy.Button(description='Reset')
self.reset_button.on_click(self.reset_coords)
self.apply_all_button = ipy.Button(description='Apply all',
layout=ipy.Layout(padding='10px'))
self.apply_all_button.on_click(self.set_highest_symmetry)
self.tolerance_descrip = ipy.HTML(u'<small>tolerance/\u212B</small>',)
self.tolerance_chooser = ipy.BoundedFloatText(value=self.tolerance.value_in(u.angstrom),
min=0.0)
self.recalculate_button = ipy.Button(description='Recalculate')
self.recalculate_button.on_click(self.coords_changed)
self.symm_pane = VBox([self.description,
self.symm_selector,
HBox([self.apply_button, self.reset_button]),
self.apply_all_button,
HBox([self.tolerance_chooser, self.recalculate_button]),
self.tolerance_descrip],
layout=ipy.Layout(width='325px'))
self.symmetry = None
self.coords_changed()
self.hbox = HBox([VBox([self.viewer, self.showing]), self.symm_pane])
super().__init__([self.hbox])