Skip to content

Instantly share code, notes, and snippets.

@jdfreder
Created October 29, 2014 19:02
Show Gist options
  • Select an option

  • Save jdfreder/e37886fbc4b748ed807d to your computer and use it in GitHub Desktop.

Select an option

Save jdfreder/e37886fbc4b748ed807d to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"name": "",
"signature": "sha256:94b9967203eda1889600d6f747bf64693e9b744ad9cf4e80a942765578fccac2"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"from IPython.html import widgets\n",
"from IPython.display import display"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"box = widgets.ContainerWidget()\n",
"step1 = widgets.DropdownWidget(values=[a for a in 'abc.'])\n",
"step2 = widgets.DropdownWidget(values=[a for a in 'abc.'], visible=False)\n",
"step3 = widgets.DropdownWidget(values=[a for a in 'abc.'], visible=False)\n",
"box.children = [step1, step2, step3]\n",
"display(box)\n",
"box.remove_class('vbox')\n",
"box.add_class('hbox')\n"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 10
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"def step1_change(name, old, new):\n",
" step2.visible = new != '.'\n",
"step1.on_trait_change(step1_change, 'value')"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 11
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment