jtpio / ipylab

Control JupyterLab from Python Notebooks with Jupyter Widgets 🧪 ☢️ 🐍

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add more examples

jtpio opened this issue · comments

There could be more examples, such as more advanced widgets, for example with bqplot:

bqplot-example

An example for:

  • Listen to JupyterLab signals (notebook opened, console closed) and trigger Python callbacks

which is mentioned in the readme would be useful :) Though I am not sure if this is even implemented right now after a glance at the codebase.

I struggle already with very simple examples like adding a code cell dynamically, most likely because I cannot find a description of the parameters to pass for the commands, like in:

from ipylab import JupyterFrontEnd

app = JupyterFrontEnd()
code = 'L = [1, 2, 3, 4])\nprint(L)'
app.commands.execute("notebook:insert-cell-below", {})
app.commands.execute("notebook:copy-cell", {})
app.commands.execute("notebook:paste-cell-below", {})

adding a code cell dynamically

Maybe something like this might help for now (although quite brittle): jupyterlab/jupyterlab#13080 (comment)

Maybe something like this might help for now (although quite brittle): jupyterlab/jupyterlab#13080 (comment)

A helpful workaround, indeed, thanks!

Maybe something like this might help for now (although quite brittle): jupyterlab/jupyterlab#13080 (comment)

A helpful workaround, indeed, thanks!

+1 for adding more examples! Especially on where to figure out what the arguments are for each command. I am also trying to add a new code cell so glad I found this thread.

Would be helpful to know how is the current API generated and how it is related to the front end docs like in https://jupyterlab.github.io/jupyterlab/classes/_application_src_index_.jupyterfrontend.html#commands

Unfortunatley the jupyterlab frontend docs are also hard to navigate so linking only partially solves the example issue