Widgets Styling Examples - is this conventional or a hack?

  1. styling HTML in the Jupyter markdown cells

For this application that is not very interesting. I wish that the css sheet for the frontend was published somewhere, but that has no bearing on the immediate problem.

  1. styling for Box in a custom widget

This is the current problem. It will also need some script to make it work. There appear to be two ways.

One way is to make style specific to the Box parent. Then the object ID can be a suffix to class names. It isn’t very often that style is object specific. It is more common that it is specific to a python class defining a widget group.

The other way is that there is display(ipywidget.HTML(" …")) at the top of the document. The module name will be prepended to css class names. Then identical class with object id numbers is not reproduced in every object.

The Layout object approach is constrained to specific styles. It looks like quite a programming chore for the Layout class implementer to make that fully functional. It is also nice to be able to use the existing style paradigm directly by putting style in the HTML widgets.

  1. actually, script is more important than style …

I have been assuming that if the style tags can be made to work, then so can script tags. As I described before, I have an accordion with data that is filled out asynchronously, and it is a shell game for the user to know if something is in each of the accordion options. I will add a marker on the banner as to whether something would be seen when the option is expanded out. I am reading about the interactive architecture now, but as a hack it looks like one can append and HTML child with script calls to add the needed info.