-
Notifications
You must be signed in to change notification settings - Fork 953
Closed
ipython/ipykernel
#1186Milestone
Description
If I wrap this code from source/docs/examples/Output Widget.ipynb
,
import ipywidgets as widgets
out = widgets.Output(layout={'border': '1px solid black'})
with out:
for i in range(10):
print(i, 'Hello world!')
in a Thread,
import ipywidgets as widgets
out = widgets.Output(layout={'border': '1px solid black'})
def foo():
with out:
for i in range(10):
print(i,'Hello world!')
IPython.display.display(out)
threading.Thread(target=foo).start()
then the output ends up in a wrong cell as soon as I execute another cell.
I would consider this a bug, as I cannot imagine anyone wanting the Output widget to change cells. To convince you of the awesomeness of updating the Output widget in the cell where it was started, imagine how easy it would be to make a simple
%%run_cell_in_background
for i in range(10):
print(i, 'Hello world!')
out of this (indeed, that's what I did, and it works beautifully except for the problem above. In my application, I need a simple job monitor, but I am sure there would be dozens of different uses for this)
Metadata
Metadata
Assignees
Labels
No labels