Skip to content

Commit 91ba29d

Browse files
committed
Remove selection container set_title and get_title
1 parent a392a31 commit 91ba29d

File tree

2 files changed

+3
-35
lines changed

2 files changed

+3
-35
lines changed

docs/source/examples/Widget List.ipynb

+3-7
Original file line numberDiff line numberDiff line change
@@ -1223,9 +1223,7 @@
12231223
"metadata": {},
12241224
"outputs": [],
12251225
"source": [
1226-
"accordion = widgets.Accordion(children=[widgets.IntSlider(), widgets.Text()])\n",
1227-
"accordion.set_title(0, 'Slider')\n",
1228-
"accordion.set_title(1, 'Text')\n",
1226+
"accordion = widgets.Accordion(children=[widgets.IntSlider(), widgets.Text()], titles=('Slider', 'Text'))\n",
12291227
"accordion"
12301228
]
12311229
},
@@ -1248,8 +1246,7 @@
12481246
"children = [widgets.Text(description=name) for name in tab_contents]\n",
12491247
"tab = widgets.Tab()\n",
12501248
"tab.children = children\n",
1251-
"for i in range(len(children)):\n",
1252-
" tab.set_title(i, str(i))\n",
1249+
"tab.titles = [str(i) for i in range(len(children))]\n",
12531250
"tab"
12541251
]
12551252
},
@@ -1347,8 +1344,7 @@
13471344
"source": [
13481345
"tab_nest = widgets.Tab()\n",
13491346
"tab_nest.children = [accordion, accordion]\n",
1350-
"tab_nest.set_title(0, 'An accordion')\n",
1351-
"tab_nest.set_title(1, 'Copy of the accordion')\n",
1347+
"tab_nest.titles = ('An accordion', 'Copy of the accordion')\n",
13521348
"tab_nest"
13531349
]
13541350
},

ipywidgets/widgets/widget_selectioncontainer.py

-28
Original file line numberDiff line numberDiff line change
@@ -29,34 +29,6 @@ def _validated_index(self, proposal):
2929
else:
3030
raise TraitError('Invalid selection: index out of bounds')
3131

32-
# Public methods
33-
def set_title(self, index, title):
34-
"""Sets the title of a container page.
35-
36-
Parameters
37-
----------
38-
index : int
39-
Index of the container page
40-
title : unicode
41-
New title
42-
"""
43-
titles = list(self.titles)
44-
titles[index] = title
45-
self.titles = titles
46-
47-
def get_title(self, index):
48-
"""Gets the title of a container page.
49-
50-
Parameters
51-
----------
52-
index : int
53-
Index of the container page
54-
"""
55-
if 0<=index<len(self.titles):
56-
return self.titles[index]
57-
else:
58-
return None
59-
6032
@register
6133
class Accordion(_SelectionContainer):
6234
"""Displays children each on a separate accordion page."""

0 commit comments

Comments
 (0)