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

Inproper styling of dataframes for nbsphinx + pydata theme when contained in ipywidget #1063

Closed
ClementPinard opened this issue Nov 16, 2022 · 3 comments · Fixed by #1089 or #1761
Closed
Labels
tag: CSS CSS and SCSS related issues

Comments

@ClementPinard
Copy link

Somehow related to #1017

I have an object with multiple dataframes, so the method _ipython_display_ constructs a tab widget and each tab gets its dataframe. It all works nicely in jupyter, but fails to have proper styling when rendered with nbsphinx + pydata sphinx

See how it's rendered in jupyter, and how it's rendered in html :

image

image

As you can see, I juxtaposed regular dataframes and dataframes contained in a ipywidget tab to show that regular tabs have the right css, while dataframes inside the tab apparently suffer from the same problem as discussed in #1017

See a simplified version of the code to display the multi dataframe object:

tab = widgets.Tab()

# create output widgets
widget_images = widgets.Output()
widget_annotations = widgets.Output()
# render in output widgets
with widget_images:
    display(self.images)
with widget_annotations:
    display(self.annotations)
tab.children = [widget_images, widget_annotations]
tab.titles = ["Images", "Annotations"]
display(tab)

Note that I considered moving to Myst-NB, but I still have some other problems with widgets rendering (see executablebooks/MyST-NB#458)

@12rambau
Copy link
Collaborator

As you pointed out, I think it's exactly the same issue as in #1017 so it should be an easy fix. Could you send the link of the second screenshot (that's easier to get the correct html selector directly from the page)?

@ClementPinard
Copy link
Author

Hi, thanks for the quick answer!

Unfortunately, this project is not open source so i cannot share this page with you.

However, I reproduced the same formatting bug in this repo : https://github.com/ClementPinard/pydata-nbsphinx-pandas-bug-example

it's just a notebook that reproduces the code given above and that is rendered with nbsphinx with pydata-sphinx-theme 0.12.0rc1

@gabalafou
Copy link
Collaborator

I'm reopening this issue because I don't think #1089 actually fixed this. I've opened a new PR #1761 to re-fix this issue.

@gabalafou gabalafou reopened this Apr 8, 2024
@trallard trallard added the tag: CSS CSS and SCSS related issues label Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tag: CSS CSS and SCSS related issues
Projects
None yet
4 participants