本文整理汇总了Python中ipywidgets.widgets.Dropdown方法的典型用法代码示例。如果您正苦于以下问题:Python widgets.Dropdown方法的具体用法?Python widgets.Dropdown怎么用?Python widgets.Dropdown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ipywidgets.widgets
的用法示例。
在下文中一共展示了widgets.Dropdown方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _simple_columnwise_widget
# 需要导入模块: from ipywidgets import widgets [as 别名]
# 或者: from ipywidgets.widgets import Dropdown [as 别名]
def _simple_columnwise_widget(ls, plot_function, columns):
"""Basic column-wise plot widget"""
dropdown = widgets.Dropdown(options=columns, description="Column:")
plot_area = widgets.Output()
update_plot(plot_function, [ls, columns[0]], plot_area, height=PLOT_HEIGHT)
dropdown.observe(
lambda x: update_plot(
plot_function, [ls, x["new"]], plot_area, height=PLOT_HEIGHT
),
names="value",
type="change",
)
return widgets.VBox([dropdown, plot_area], padding=PADDING)
示例2: DrawDNNWeights
# 需要导入模块: from ipywidgets import widgets [as 别名]
# 或者: from ipywidgets.widgets import Dropdown [as 别名]
def DrawDNNWeights(fac, datasetName, methodName="DNN"):
m = GetMethodObject(fac, datasetName, methodName)
if m == None:
return None
try:
net = GetDeepNetwork(str(m.GetWeightFileName()), True)
except AttributeError:
print("STANDARD architecture not supported! If you want to use this function you must use CPU or GPU architecture")
numOfLayers = len(net["layers"])
options = []
vals=[]
for layer in xrange(numOfLayers):
options.append(str(layer)+"->"+str(layer+1))
vals.append(layer)
selectLayer=widgets.Dropdown(
options=options,
value=options[0],
description='Layer'
)
def drawWrapper(e):
CreateWeightHist(net, selectLayer.value)
pass
button = widgets.Button(description="Draw", font_weight="bold", font_size="16")
button.on_click(drawWrapper)
box = widgets.HBox([selectLayer, button])
display(box)
示例3: create_pairdensity_plot_widget
# 需要导入模块: from ipywidgets import widgets [as 别名]
# 或者: from ipywidgets.widgets import Dropdown [as 别名]
def create_pairdensity_plot_widget(ls):
"""Create a pairwise density widget.
Parameters
----------
ls : :class:`~lens.Summary`
Lens `Summary`.
Returns
-------
:class:`ipywidgets.Widget`
Jupyter widget to explore pairdensity plots.
"""
numeric_columns = ls._report["column_summary"]["_columns"]
dropdown1 = widgets.Dropdown(options=numeric_columns, description="First:")
dropdown2 = widgets.Dropdown(
options=numeric_columns, description="Second:"
)
if len(numeric_columns) > 1:
dropdown1.value, dropdown2.value = numeric_columns[:2]
plot_area = widgets.Output()
for dropdown in [dropdown1, dropdown2]:
dropdown.observe(
lambda x: _update_pairdensity_plot(
ls, dropdown1, dropdown2, plot_area
),
names="value",
type="change",
)
_update_pairdensity_plot(ls, dropdown1, dropdown2, plot_area)
return widgets.VBox([dropdown1, dropdown2, plot_area], padding=PADDING)