Embedding¶
There are several ways to export and view Evince outside the Jupyter environemt. Here we show three standard methods.
The Widget dropdown menu in Jupyter Notebooks¶
Run the cell below and press "Widgets>Embed Widgets" in the dropdown-menu above. This will display a string which may be copy-pasted into your html-file, adding your view to it.
In [3]:
Copied!
import braketlab as bk
m = bk.basisbank.get_harmonic_oscillator_function(10).view(web = True)
m
import braketlab as bk
m = bk.basisbank.get_harmonic_oscillator_function(10).view(web = True)
m
Out[3]:
Automation with IPywidgets¶
Another option for embedding is to automatically generate the embedding script above using the embed_minimal_html
-function:
In [4]:
Copied!
from ipywidgets.embed import embed_minimal_html
embed_minimal_html("my_export.html", [m]) # export the widget to a html-file
from ipywidgets.embed import embed_minimal_html
embed_minimal_html("my_export.html", [m]) # export the widget to a html-file
NBConvert¶
Finally, the NBConverter is a convenient way to turn you notebooks into static html.
First, run you notebook and press "Widgetst>Save notebook widget state". Then, from the command line, run
>nbconvert filename --to html
The widget will be now automatically included in the output html-file.
In [ ]:
Copied!