[IPython-dev] How-To create persistent, interactive UI elements outside cells

Matthias Bussonnier bussonniermatthias at gmail.com
Fri Nov 28 09:26:48 EST 2014


Hi,

Please excuse the following explanation which is hand waved, I'll come back to you at a later point with more detail once I'm not traveling anymore. Feel free to up the question if we don't come back.

What you want to do is to have a notebook extension (see github/IPython-contrib) and add a custom button to the main cellToolBar. See default custom.js for code sample that adds a button that open QTconsole. 
You want to grab a handle to the kernel (IPython.notebook.kernel) in JavaScript, and call it's execute method with your own callbacks. 

It seem that the route you took is more bending the current architecture where it's not supposed to be instead of reusing base bricks.

The exact response to your question depends on wether you want data from the **server** or from the **kernel**. I believe you meant kernel, but it's not completely clear.


-- 
M

Envoyé de mon iPhone

> Le 28 nov. 2014 à 14:59, Hack-The-Paradise <sk.spiros at hotmail.com> a écrit :
> 
> Hello World,
> 
> Me and my colleagues we are working on a project concerning big data
> handling, filtering and visualizing. We are trying to use IPython Notebook
> as our UI. We think that Notebook is a very nice and suitable tool.
> 
> Our goal is to extend its functionality according to our needs.
> We have encountered some problems during this procedure and we tried to ask
> for help in  https://gitter.im/ipython/ipython/help#
> <https://gitter.im/ipython/ipython/help#>    but the answers were very
> limited, so i took the initiative to ask also here.
> 
> We are trying to create (let’s say) a custom UI element and want to connect
> it with the server side (e.g. a help button with dynamic content in the
> toolbar).
> 
> *Our main objective* is that we want to share this UI element on all our
> notebooks and load that on the startup of every notebook automatically. *So
> It should not be coupled with the cells*. 
> 
> A perfect example of what we are trying to achieve is the following:
> Let’s assume that we have what is described in this github repository:
> https://github.com/ipython-contrib/IPython-notebook-extensions/wiki/help_panel
> 
> When the user clicks a button a list of help is shown on a panel on the
> right side of the screen.
> Currently, the data that populate this panel are static and what we want is
> to replace this by using iPython MVC widgets framework to have a model of
> these data stored on the notebook server. So that the list is synchronized
> with the model. *The code for this should not be typed into the cells but
> should be executed automatically upon loading of a notebook* (i.e. creating
> or opening an existing notebook).
> 
> *Is there a functionality already built-in in ipython/notebook that
> implements something similar or we need to create/extend that?* Given the
> fact that we have limited time. 
> 
> Some of our ideas were:
> -    Hiding specific cells with the code (also protecting them in order to
> emulate persistency)
> -    execute JavaScript code from markdown cells (but I think this is not
> possible anymore or not?)
> 
> i think that the following conversation is similar to our interest:
> http://python.6.x6.nabble.com/Feasilibity-of-widgets-layout-for-mimicking-this-td5068197.html
> 
> The following image is also a nice example of what we want to accomplish but
> it is not complete. In that case the code is implemented in cells
> <http://python.6.x6.nabble.com/file/n5079080/wP3VmWK.png> 
> 
> *P.S.:* Of course we already managed to build our own widgets following the
> given structure and using JavaScript but still we could not avoid using
> cells (at least for display command)
> We can provide code snippets if it is necessary.
> 
> *Our default Env:*
> Anaconda 2.1.0 (x64) – iPython 2.3.1 – Python 2.7.8
> 
> 
> 
> 
> --
> View this message in context: http://python.6.x6.nabble.com/How-To-create-persistent-interactive-UI-elements-outside-cells-tp5079080.html
> Sent from the IPython - Development mailing list archive at Nabble.com.
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev



More information about the IPython-dev mailing list