ipywidgets icon indicating copy to clipboard operation
ipywidgets copied to clipboard

clear_output clears the sub_outputs

Open kartfull opened this issue 3 years ago • 0 comments
trafficstars

Description

cc jasongrout jtpio Considering an output (main) containing another output (sub-output), while the main output is displaying, clear_output for the main one would clear the sub-output as well.

Note: to simulate it please keep the order of cells. First cell:

import ipywidgets as widgets
from ipywidgets import Button,Output
from IPython.display import display
out1=Output() #sub-output
but=Button(description='B')
out2=Output() #main output
with out1:
    display(but)
with out2:
    display(out1)
display(out2)

Second cell: out2.clear_output() Third cell: display(out1)

The result of the last cell is an empty output. image

The point is that when the main output is not displaying it works properly. image

Expected behavior

It is expected that only the main output would be cleared, and the sub-output would remain unchanged. image

kartfull avatar Apr 21 '22 19:04 kartfull