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

jupyter: PerspectiveWidget rendering is broken inside VBox #2248

Open
tomjakubowski opened this issue Jun 6, 2023 · 6 comments
Open

jupyter: PerspectiveWidget rendering is broken inside VBox #2248

tomjakubowski opened this issue Jun 6, 2023 · 6 comments
Labels
bug Concrete, reproducible bugs

Comments

@tomjakubowski
Copy link
Contributor

Bug Report

In Jupyter Lab PerspectiveWidget doesn't render correctly inside a VBox.

Screenshot 2023-06-06 at 4 20 49 PM

You can see that little sliver of the perspective viewer UI on the right hand side of the notebook. I can click and drag the resize grabber, but doing that doesn't make the viewer any taller (or shorter).

Steps to Reproduce:

Create a Jupyter Lab instance, install perspective-python (I got perspective_python-2.2.1-cp310-cp310-macosx_11_0_arm64.whl)

# cell 0
from ipywidgets import Button, HBox, VBox
from perspective import PerspectiveWidget

def button(n):
    return Button(description=n)

# cell 1
# VBox doesn't work
VBox([button("A"), button("B"), PerspectiveWidget({"x": int}), button("D")])

# cell 2
# HBox does work
HBox([button("A"), button("B"), PerspectiveWidget({"x": int}), button("D")])

Expected Result:

See a usable perspective widget

Actual Result:

Only see a sliver of UI, and unable to resize widget

Environment:

  • Jupyter Lab Version 3.5.3
  • Perspective 2.2.1
  • Chrome 114, macOS

Additional Context:

HBox and VBox use flexbox https://ipywidgets.readthedocs.io/en/7.6.3/examples/Widget%20Styling.html#The-VBox-and-HBox-helpers

It may be that fiddling with flexbox properties on the the layout property of the widget and/or the Box containing it could fix this

@texodus texodus added the bug Concrete, reproducible bugs label Jun 7, 2023
@timkpaine
Copy link
Member

I would expect this to be a duplicate of #1957 and similar, e.g. perspective expects its container to be sized, it has no size on its own

@hanzotutu
Copy link

I am using ipywidgets 8.1.0, and perspective-python 2.3.2. PerspectiveWidget doesn't take keyword argument "layout".

@finos finos deleted a comment from sundeep1299 Oct 17, 2023
@dhirschfeld
Copy link
Contributor

This sounds like the same issue I saw with the PerspectiveWidget: widgetti/reacton#6 (comment)

There it was suggested by Maarten Breddels that the PerspectiveWidget might not be hooking up the lumino resize events correctly: widgetti/reacton#6 (comment)

He also linked to a PR demonstrating how to use the browser ResizeObserver:
bqplot/bqplot#1531

Possibly something to investigate...

@jonathanng
Copy link

Anyone able to get this working?

@dhirschfeld
Copy link
Contributor

Anyone able to get this working?

From the linked issue: I was able to work around that by wrapping the perspective table in an Output widget

Not ideal, but at least it was possible. I haven't tried again since though so YMMV.

@finos finos deleted a comment from ashita1512 May 16, 2024
@jgunstone
Copy link

just tried this with a fresh install -
my workaround was to put the PerspectiveWidget within an output widget but this feels hacky as a long-term fix

environment.yml

name: perspective-test
channels:
  - defaults
  - conda-forge
dependencies:
  - python
  - jupyterlab
  - perspective
mamba env create -f environment.yml

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Concrete, reproducible bugs
Projects
None yet
Development

No branches or pull requests

7 participants