[IPython-dev] Proper use of accordion widget

Doug Blank doug.blank at gmail.com
Thu Mar 20 12:11:02 EDT 2014


I can confirm that this does not work as expected:

from IPython.html.widgets import AccordionWidget, ButtonWidget
aw = AccordionWidget(children=[ButtonWidget()])
aw

while this does:

from IPython.html.widgets import TabWidget, ButtonWidget
tw = TabWidget(children=[ButtonWidget()])
tw

-Doug

On Wed, Mar 19, 2014 at 10:04 AM, Winters, Kevin D  ERDC-RDE-CHL-MS
<Kevin.D.Winters at erdc.dren.mil> wrote:
> I'm attempting to use an accordion widget in my notebook, however I can't
> get the contents to display. I assumed that the AccordionWidget should be
> defined similarly to the TabWidget. Here's my test code:
>
> from IPython.html import widgets # Widget definitions
> from IPython.display import display # Used to display widgets in the
> notebook
>
> acc = widgets.AccordionWidget()
> #acc = widgets.TabWidget()
>
> this = widgets.ContainerWidget()
> this.children = [widgets.CheckboxWidget(description='this', value=True)]
> that = widgets.ContainerWidget()
> that.children = [widgets.CheckboxWidget(description='that', value=False)]
>
> acc.children = [this, that]
> dictPages = {0:'This', 1:"That"}
>
> display(acc)
> acc.set_css({'border':'3px solid black', 'height':'500px', 'width':'500px'})
> for page in dictPages:
>     acc.set_title(page, dictPages[page])
> for page in acc.children:
>     page.set_css({'height':'150px'})
> acc.selected_index = 1
>
> Am I missing something or is there a bug in the accordion display?
>
> Thanks,
>
> Kevin
> --------------------
> Kevin Winters
> Research Hydraulic Engineer
> US Army Corps of Engineers
> Engineer Research and Development Center
> 3909 Halls Ferry Road
> Vicksburg, MS 39180
> 601.634.2102
>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>



More information about the IPython-dev mailing list