question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Close a widget but the associate '<div class="output_area">' still exists

See original GitHub issue

Since 7.0 widgets in notebook are rendered in <div class="output_area">, but when I close a widget, the associate <div class="output_area"> still exists.

from ipywidgets import Layout, Button, Box
from IPython.display import display
items = [Button(description='example') ]
box1 = Box(children=items)
box2 = Box(children=items)
box3= Box(children=items)
display(box1)
display(box2)
display(box3)
box2.close()

output: div_output

How could I remove this part ?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:22 (12 by maintainers)

github_iconTop GitHub Comments

11reactions
dovahcrowcommented, Jul 8, 2019

Are we gonna solve this issue in ipywidgets or jupyter? As of today (ipywidgets 7.5.0, jupyterlab 1.0.1, this empty div problem is still there.

3reactions
nanoantcommented, Sep 17, 2018

FYI I identified the source of the problem in JupyterLab – each removed output is nested in some two additional divs:

<div class="p-Widget p-Panel jp-OutputArea-child">
  <div class="p-Widget jp-OutputPrompt jp-OutputArea-prompt"></div>
  <div class="p-Widget p-Panel jp-OutputArea-output p-mod-hidden"></div>
</div>

While 2nd inner div with p-mod-hidden gets display: none CSS the first jp-OutputPrompt jp-OutputArea-prompt has non-zero padding and border, even when has no content at all, causing the space to grow. I believe this is a problem at the junction of ipywidgets and JupyterLab. I don’t know if there is a way to remove output completely (instead hiding it), so these divs do not remain at all. My current workaround is an additional CSS:

.p-Widget.jp-OutputPrompt.jp-OutputArea-prompt:empty {
  padding: 0;
  border: 0;
}

This is far from perfect as still the internal DOM grows with empty divs, we just don’t see that anymore. And btw. please re-open this issue as the problem is NOT fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Delete old widgets from iPhone - Apple Community
I can add and delete the newer widgets but I cannot delete all the old ones that are still there of which most...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found