Skip to content

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

@ClementPinard

Description

@ClementPinard

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    tag: CSSCSS and SCSS related issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions