[IPython-dev] [EXTERNAL] rant: "%matplotlib inline"
Matthias Bussonnier
bussonniermatthias at gmail.com
Mon Jul 6 12:24:59 EDT 2015
> On Jul 6, 2015, at 11:18, Shead, Timothy <tshead at sandia.gov> wrote:
>
>> On Jul 6, 2015, at 9:35 AM, Matthias Bussonnier <bussonniermatthias at gmail.com> wrote:
>>
>> I’m curious to know how you detect you are in a notebook in a reliable manner.
>
> Matthias:
>
> The following code gets executed once when Toyplot is imported:
>
> [... snip]
>
> … where the “Canvas” class has a _repr_html_(self) that returns the HTML representation of a figure, and Canvas._autorender_list is a list of Canvas objects to be rendered inline. You could imagine adapting the _ipython_post_execute() callback to work with arbitrary objects, including libraries that are completely “IPython-unaware”.
Oh, ok, sure. This does not “detect” that you are in a notebook. It use the REPR machinery to display things in any
fronted that would support HTML, like nbconvert, or Hydrogen.
I read your previous mail as actually something like getting a boolean `is_notebook`.
--
M
More information about the IPython-dev
mailing list