Created
October 30, 2013 04:48
-
-
Save ellisonbg/7227354 to your computer and use it in GitHub Desktop.
Interact Examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"from IPython.html.widgets.interact import interact\n", | |
"from IPython.display import clear_output, display, HTML" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"javascript": [ | |
"$.getScript(\"/static/notebook/js/widgets/bool.js\");" | |
], | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": [ | |
"<IPython.core.display.Javascript at 0x105f8c910>" | |
] | |
}, | |
{ | |
"javascript": [ | |
"$.getScript(\"/static/notebook/js/widgets/button.js\");" | |
], | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": [ | |
"<IPython.core.display.Javascript at 0x105f8c910>" | |
] | |
}, | |
{ | |
"javascript": [ | |
"$.getScript(\"/static/notebook/js/widgets/container.js\");" | |
], | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": [ | |
"<IPython.core.display.Javascript at 0x105f8c910>" | |
] | |
}, | |
{ | |
"javascript": [ | |
"$.getScript(\"/static/notebook/js/widgets/float.js\");" | |
], | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": [ | |
"<IPython.core.display.Javascript at 0x105f8c910>" | |
] | |
}, | |
{ | |
"javascript": [ | |
"$.getScript(\"/static/notebook/js/widgets/float_range.js\");" | |
], | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": [ | |
"<IPython.core.display.Javascript at 0x105f8c950>" | |
] | |
}, | |
{ | |
"javascript": [ | |
"$.getScript(\"/static/notebook/js/widgets/int.js\");" | |
], | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": [ | |
"<IPython.core.display.Javascript at 0x105f8c910>" | |
] | |
}, | |
{ | |
"javascript": [ | |
"$.getScript(\"/static/notebook/js/widgets/int_range.js\");" | |
], | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": [ | |
"<IPython.core.display.Javascript at 0x105f8c910>" | |
] | |
}, | |
{ | |
"javascript": [ | |
"$.getScript(\"/static/notebook/js/widgets/multicontainer.js\");" | |
], | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": [ | |
"<IPython.core.display.Javascript at 0x105f8cb90>" | |
] | |
}, | |
{ | |
"javascript": [ | |
"$.getScript(\"/static/notebook/js/widgets/selection.js\");" | |
], | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": [ | |
"<IPython.core.display.Javascript at 0x105f8c950>" | |
] | |
}, | |
{ | |
"javascript": [ | |
"$.getScript(\"/static/notebook/js/widgets/string.js\");" | |
], | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": [ | |
"<IPython.core.display.Javascript at 0x105f8c950>" | |
] | |
} | |
], | |
"prompt_number": 1 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"def show_args(**kwargs):\n", | |
" s = '<h3>Arguments:</h3><table>\\n'\n", | |
" for k,v in kwargs.items():\n", | |
" s += '<tr><td>{0}</td><td>{1}</td></tr>\\n'.format(k,v)\n", | |
" s += '</table>'\n", | |
" display(HTML(s))" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 2 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"interact(show_args, a=(0,10), d=(0.,10.), e=(-10.,10.,0.01), z=(True,False),\n", | |
" blast_off=(False, True), b=u'wow this is cool',\n", | |
" algorithm=['This','That','Other'])" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"html": [ | |
"<h3>Arguments:</h3><table>\n", | |
"<tr><td>a</td><td>5</td></tr>\n", | |
"<tr><td>b</td><td>wow this is cool</td></tr>\n", | |
"<tr><td>e</td><td>0.0</td></tr>\n", | |
"<tr><td>d</td><td>5.0</td></tr>\n", | |
"<tr><td>algorithm</td><td>Other</td></tr>\n", | |
"<tr><td>z</td><td>True</td></tr>\n", | |
"<tr><td>blast_off</td><td>False</td></tr>\n", | |
"</table>" | |
], | |
"metadata": {}, | |
"output_type": "display_data", | |
"text": [ | |
"<IPython.core.display.HTML at 0x105f8cbd0>" | |
] | |
} | |
], | |
"prompt_number": 3 | |
} | |
], | |
"metadata": {} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment