[IPython-dev] Applying arbitrary CSS to an IPython 3.0 widget

Adam Hughes hughesadam87 at gmail.com
Fri Mar 6 18:07:06 EST 2015


Slick indeed!  Thanks for sharing

On Fri, Mar 6, 2015 at 6:05 PM, Nicholas Bollweg <nick.bollweg at gmail.com>
wrote:

> Here's the only usage as I found in the source:
> container = Box(_dom_classes=['widget-interact'])
>
>
> https://github.com/ipython/ipython/blob/0c6a0f7982d430b3e4ff55c1fa04aca58a4fdb16/IPython/html/widgets/interaction.py#L184
>
> Looks like each tuple member is a triple of (selector, property, value):
>
> txt = widgets.Text(value="Stratocaster")
> display(txt)
> txt._css = [
>   ("input", "font-family", "Comic Sans MS"),
>   (None, "transform", "matrix(1, -0.2, 0, 1, 0, 0)")
> ]
>
> Pretty slick!
>
> On Fri, Mar 6, 2015 at 5:48 PM, Nathan Goldbaum <nathan12343 at gmail.com>
> wrote:
>
>> Hi all,
>>
>> Does anyone have an example of how to apply CSS to a notebook widget in
>> IPython 3.0?  Old versions offered the set_css method, but that has been
>> removed in the latest version.
>>
>> I see in the widget transition doc:
>>
>>
>> https://github.com/ipython/ipython/wiki/IPython-3.0-comm-and-widget-migration-document
>>
>> that set_css has been superseded by the CSS attributes (works fine for
>> most things, but not for obscure CSS settings) and the _dom_classes and
>> _css tuples (not dictionaries as indicated in the transition doc).  The
>> latter seems perfect, but it's not clear to me how to use these tuples.
>>
>> Is there an example somewhere I can look at?
>>
>> Thanks!
>>
>> -Nathan
>>
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>
>>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20150306/d0cadcba/attachment.html>


More information about the IPython-dev mailing list