Rich display and IPython display module in Jupyter QtConsole

521 views
Skip to first unread message

Indranil Sinharoy

unread,
Dec 3, 2015, 8:33:47 PM12/3/15
to Project Jupyter
Hi, 

I have been using IPython QtConsole and the IPython Notebook quite a lot, and I love them both. After transition to Jupyter QtConsole and Jupyter Notebook, I have observed that some rich text display stopped working in the QtConsole (It still works in the Notebook). To clarify, there is a small bit of code:



import IPython.core.display as display class Prettify(object): """prettify using IPython display() """ def __init__(self, text): self.text = text def _repr_html_(self): return ("<font color='red'><b>{text}</font></b> is great!".format(text=self.text,)) def __repr__(self): return "%s" % (self.text) display.display(Prettify("IPython"))



When I execute the above code from a Jupyter notebook, the output looks like so:


IPython is great!


However, executing the same code in the Jupyter QtConsole, the output looks like the following:

IPython

Please, note that I have used the above pattern in the past that resulted in identical rich text output in both notebook and QtConsole. 

So, the question is that what has changed in Jupyter QtConsole w.r.t. the display module? And what can I do to produce rich text display in Jupyter QtConsole?

Thank you very much,
Best regards,
Indranil.

Thomas Kluyver

unread,
Dec 4, 2015, 5:39:22 AM12/4/15
to Project Jupyter
Hi Indranil,

On 4 December 2015 at 01:33, Indranil Sinharoy <indranil...@gmail.com> wrote:
So, the question is that what has changed in Jupyter QtConsole w.r.t. the display module? And what can I do to produce rich text display in Jupyter QtConsole?

We decided to turn off the display of HTML objects in the Qt console, because it only supports a very limited subset of HTML, and most of what people were interested in displaying either looked wrong or didn't work at all. We had projects like pandas resorting to awkward hacks to try to tell when they were running in the Qt console, just so they could disable HTML output.

One of our ideas that hasn't quite happened yet is to build an HTML console, reusing some of the Javascript pieces from the notebook interface. We expect that that will largely replace the Qt console, and of course it will be fully able to display HTML output.

Thomas

Indranil Sinharoy

unread,
Dec 4, 2015, 10:52:20 AM12/4/15
to Project Jupyter
Hi Thomas,

Thank you, for nicely clarifying. 

Best regards,
Indranil. 
Reply all
Reply to author
Forward
0 new messages