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


Python widgets.Dropdown方法代碼示例

本文整理匯總了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) 
開發者ID:facultyai,項目名稱:lens,代碼行數:18,代碼來源:widget.py

示例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) 
開發者ID:dnanexus,項目名稱:parliament2,代碼行數:28,代碼來源:Factory.py

示例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) 
開發者ID:facultyai,項目名稱:lens,代碼行數:37,代碼來源:widget.py


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