[IPython-dev] Proper use of accordion widget

Winters, Kevin D ERDC-RDE-CHL-MS Kevin.D.Winters at erdc.dren.mil
Wed Mar 19 10:04:30 EDT 2014


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140319/3cd6e44c/attachment.html>


More information about the IPython-dev mailing list