选择ipython小部件的下拉键

时间:2015-12-08 02:34:27

标签: python drop-down-menu widget ipython

在创建ipython下拉窗口小部件时,

$stmt = $db->prepare("SELECT image FROM candidates WHERE idno = ?");
$stmt->bind_param("i", $_POST["candidateid"]);
$stmt->execute();
$stmt->bind_result($image); /* GET THE CORRESPINDING IMAGE */
$stmt->fetch();
$stmt->close();

echo '<img src="/system/admin/savephp/images/'.$image.'">'; /* WHAT YOU ECHO IS WHAT WILL BE RETURNED IN YOUR MAIN FILE */

我可以用

from IPython.html import widgets
from IPython.display import display

d = {"1": "a", "2": "b"}

dropdown = widgets.Dropdown(options=d)
display(dropdown)

从下拉窗口小部件中打印所选键的值。如何获取在下拉列表中单击的键(&#34; 1&#34;,&#34; 2&#34;)?使用

print dropdown.value

不起作用。

1 个答案:

答案 0 :(得分:0)

存储在dropdown.selected_label

我无法找到this one

的任何其他引用