Hi all,

Apologies for the newbie question. 

How does one design a Jupyter widget (DOMWidget) that can modify the notebook 
itself? For example, given a sample DOMWidget, let's say I want a button that 
upon clicking inserts a new cell:

define('hello', ["@jupyter-widgets/base"], function(widgets) {

    var HelloView = widgets.DOMWidgetView.extend({

        // Render the view.
        render: function() {
            this.el = /* creates some sort of HTML button */;
        },
    });

    return {
        HelloView: HelloView
    };
});

Is the right thing to do to modify render, render an HTML button, and then have 
its onclick event perform something like:

IPython.notebook.insert_cell_below('code').set_text('some text');

Or is there some better/more appropriate strategy?

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jupyter+unsubscr...@googlegroups.com.
To post to this group, send email to jupyter@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/1536601350.1530800.1503185984.1A58B039%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to