[IPython-dev] HTML display does not works when using Widgets

Andrew Payne andy at payne.org
Thu Jul 17 10:51:30 EDT 2014


>     def my_func():
>         HTML("<b>Some html</b>")
>         some_widget.interact #display widget
>
> When I call this function from the notebook, only widget is rendered on
> the output cell, not the HTML.
> I guess that might be because widgets use different "type" of output method
> compared to usual output method.
>

Try calling display(HTML("your html")).  See:
http://ipython.org/ipython-doc/dev/api/generated/IPython.core.display.html#IPython.core.display.display

display() causes your Python object to be displayed on the frontend (e.g.
in the notebook).  IPython normally displays last item in the cell / return
value for you automatically, but you can call display() directly to force
an object (other than the last item) to be displayed.

For example:

[image: Inline image 1]

I hope this is helpful.

-andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140717/fd36c2cd/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot_071714_105041_AM.jpg
Type: image/jpeg
Size: 26639 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140717/fd36c2cd/attachment.jpg>


More information about the IPython-dev mailing list