Closed
Description
I work on a widget that does DataFrame visualization and codegen. I want the widget to be able create a cell immediately below it, and inject then edit code in that cell.
I want to create a new cell, then get a reference to that created cell (by id or something else) then be able to edit that cell.
I have found a code snippet to edit a cell, but I don't know how to edit a cell, or find the cell I just created.
from IPython.core.getipython import get_ipython
def create_new_cell(contents):
shell = get_ipython()
payload = dict(
source='set_next_input',
text=contents,
replace=False,
)
return shell.payload_manager.write_payload(payload, single=False)
I have reviewed the docs here, and I don't obviously see how to do this?
https://jupyter-client.readthedocs.io/en/latest/messaging.html
Any suggestions?
Metadata
Metadata
Assignees
Labels
No labels