Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notebooks utilizing ipywidgets.Output() don't work with progressive rendering #394

Closed
timkpaine opened this issue Oct 2, 2019 · 11 comments
Labels
bug Something isn't working

Comments

@timkpaine
Copy link
Member

include the following in a cell after the first

class Test(object):
    def __init__(self):
        self.view = ipywidgets.Output()
t = Test()
@SylvainCorlay SylvainCorlay added the bug Something isn't working label Oct 2, 2019
@martinRenou
Copy link
Member

I am not sure I understand this issue... What is not working exactly?

@timkpaine
Copy link
Member Author

The notebook won't render at all, there's more background on gitter

@timkpaine
Copy link
Member Author

#396 might inadvertently fix this

@martinRenou
Copy link
Member

Ok, sorry I did not pay attention to the gitter discussion. I will try on my branch and on master.

@martinRenou
Copy link
Member

You are talking about this notebook, right?

# Cell 1
import time
from ipywidgets import *
from IPython.display import display

# Cell 2
class Test(object):
    def __init__(self):
        self.layout = Output()
        with self.layout:
            print('Hello world')
        
    def render(self):
        display(self.layout)

# Cell 3
time.sleep(10)
t = Test()

# Cell 4
t.render()

I added the print('Hello world') so that we have something displayed. It seems to work for me both on master and on #396... Might be a race condition

@timkpaine
Copy link
Member Author

What happens if you don't use the output, just instantiate it e.g. remove the with layout

@martinRenou
Copy link
Member

martinRenou commented Oct 3, 2019

Well it does not show anything as expected. The Output is there, just not visible because it's empty.
You could see it if you change its style like self.layout.layout.border = '2px dashed red'. You would see it's there, only it's empty.

@timkpaine
Copy link
Member Author

For me the page spins, and nbconvert hangs on connecting to the existing kernel

@martinRenou
Copy link
Member

Weird. I cannot reproduce it locally.

The thing is the current master reconnects to the kernel for each cell... That is fixed in 396, which may be why your use case now works.

@timkpaine
Copy link
Member Author

Yeah I will test to make sure. It was hanging on a wait_for_kernel but since we don't disconnect now it should be fine

@maartenbreddels
Copy link
Member

#396 fixes some output issues indeed, I was chasing a different bug for interact, so I think before this PR the outputs were buggy. I'm assuming you problem is also fixed, otherwise feel free to reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants