[IPython-dev] More widget feasibility ideas
Nicholas Bollweg
nick.bollweg at gmail.com
Mon Oct 27 22:45:29 EDT 2014
For reference, I see this:
[image: Inline image 3]
ah, the _dom_classes may have been more recent than that. Here's the
change, landed sept 23: https://github.com/ipython/ipython/pull/6235
you may have to go back to something like:
w = HTML("text")
> w.on_displayed(lambda x: w.add_class("alert-warning")
>
When you want to change it, you'd then have to:
w.remove_class("alert-warning")
> w.add_class("alert-success")
>
In the new core widgets, a traitlet manages these directly:
https://github.com/ipython/ipython/blob/master/IPython/html/widgets/widget_button.py#L36
And all the class adding/removing is done on the client side.
In my bootstrap librar <https://github.com/bollwyvl/ip-bootstrap>y i have
been tinkering with, I did the same, though a little differently.
On Mon, Oct 27, 2014 at 8:55 PM, Adam Hughes <hughesadam87 at gmail.com> wrote:
> Yes, but when you do this in your notebook, does it appear in a different
> colors? Mine looks like plain text. IE I literally see:
>
> info
> danger
> warning
> success
>
> In my output cell, instead of pretty colors like the example on the
> bootstrap link. Using about a 2week-old version of 3.0 dev, if that
> matters.
>
> On Mon, Oct 27, 2014 at 8:50 PM, Nicholas Bollweg <nick.bollweg at gmail.com>
> wrote:
>
>> right, you'd switch it out to another context:
>>
>> from IPython.html import widgets
>>> from IPython.display import display
>>> for context in ["info", "danger", "warning", "success"]:
>>> display(widgets.HTML(value=context, _dom_classes=["alert", "alert-"
>>> + context]))
>>>
>>
>> _______________________________________________
>> 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/20141027/4f2145ad/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2014-10-27_2239.png
Type: image/png
Size: 47090 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20141027/4f2145ad/attachment.png>
More information about the IPython-dev
mailing list