IPython magics to embed http://www.pythontutor.com within an IFrame in the IPython notebook using the code from an IPython code cell.
pip install tutormagic
or
pip install git+https://github.com/kikocorreoso/tutormagic.git
Tested on Python 2.7 and Python 3.4 and IPython/Jupyter 3.x/4.x.
First, load the extension:
%load_ext tutormagic
Once loaded, in a code cell in the notebook type the following:
%%tutor --lang python3
# some python code
# ...
The only available option is the --lang
or -l
that allows you to choose one of the available languages supported by
pythontutor
%%tutor --lang python3
or%%tutor -l python3
or%%tutor
to show a pythontutor IFrame with python3 code.%%tutor --lang python2
or%%tutor -l python2
to show a pythontutor IFrame with python2 code.%%tutor --lang java
or%%tutor -l java
to show a pythontutor IFrame with java code.%%tutor --lang javascript
or%%tutor -l javascript
to show a pythontutor IFrame with javascript code.
The name of the extension was suggested by @dsblank.