Skip to content

Instantly share code, notes, and snippets.

@steve0hh
Created November 27, 2017 16:00
Show Gist options
  • Save steve0hh/324cdc65e95493309988e0eb0d94c623 to your computer and use it in GitHub Desktop.
Save steve0hh/324cdc65e95493309988e0eb0d94c623 to your computer and use it in GitHub Desktop.
[ipython notebook tricks] Creates a link which toggles the input cells
from IPython.display import HTML
HTML("""
<script>
var code_show=true; //true -> hide code at first
function code_toggle() {
if (code_show){
$('div.input').hide();
$('div.prompt').hide();
} else {
$('div.input').show();
$('div.prompt').show();
}
code_show = !code_show
}
$( document ).ready(code_toggle);
</script>
<a href="javascript:code_toggle()">[Toggle Code]</a>
""")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment