Search code examples
jupyter-notebookipywidgets

How to get the width of output cell of Jupyter notebook?


I am creating a custom widget (ipywidget) and I need to get the width of the output cell of Jupyter notebook at runtime. So that I can occupy maximum width with my widget.


Solution

  • We can get the width of output cell (in px) using this.el.getBoundingClientRect(), which returns the following object:

    enter image description here