|
8 | 8 | "source": [
|
9 | 9 | "# `widget-periodictable`: A Jupyter Widget to Create Interactive Periodic Table\n",
|
10 | 10 | "\n",
|
11 |
| - "**Source code**:https://github.com/osscar-org/widget-periodictable\n", |
| 11 | + "**Source code**:[https://github.com/osscar-org/widget-periodictable](https://github.com/osscar-org/widget-periodictable) \n", |
12 | 12 | "\n",
|
13 | 13 | "**Introduction**: The periodic table is an important tool for chemistry and physics \n",
|
14 | 14 | "education and research. This is a Jupyter widget to create an interactive periodic \n",
|
|
47 | 47 | },
|
48 | 48 | {
|
49 | 49 | "cell_type": "code",
|
50 |
| - "execution_count": 3, |
| 50 | + "execution_count": null, |
51 | 51 | "metadata": {},
|
52 | 52 | "outputs": [],
|
53 | 53 | "source": [
|
|
71 | 71 | },
|
72 | 72 | {
|
73 | 73 | "cell_type": "code",
|
74 |
| - "execution_count": 4, |
| 74 | + "execution_count": null, |
75 | 75 | "metadata": {},
|
76 |
| - "outputs": [ |
77 |
| - { |
78 |
| - "data": { |
79 |
| - "application/vnd.jupyter.widget-view+json": { |
80 |
| - "model_id": "c59bf12be17a454c89589d7b154857dc", |
81 |
| - "version_major": 2, |
82 |
| - "version_minor": 0 |
83 |
| - }, |
84 |
| - "text/plain": [ |
85 |
| - "PTableWidget(allElements=['H', 'He', 'Li', 'Be', 'B', 'C', 'N', 'O', 'F', 'Ne', 'Na', 'Mg', 'Al', 'Si', 'P', '…" |
86 |
| - ] |
87 |
| - }, |
88 |
| - "metadata": {}, |
89 |
| - "output_type": "display_data" |
90 |
| - } |
91 |
| - ], |
| 76 | + "outputs": [], |
92 | 77 | "source": [
|
93 | 78 | "widget = PTableWidget(states = 3, selected_elements = {\"C\": 0, \"Si\": 1, \"Ge\": 2}, \n",
|
94 | 79 | " selected_colors = ['red', 'green', 'blue'], \n",
|
|
111 | 96 | },
|
112 | 97 | {
|
113 | 98 | "cell_type": "code",
|
114 |
| - "execution_count": 5, |
| 99 | + "execution_count": null, |
115 | 100 | "metadata": {},
|
116 | 101 | "outputs": [],
|
117 | 102 | "source": [
|
|
128 | 113 | },
|
129 | 114 | {
|
130 | 115 | "cell_type": "code",
|
131 |
| - "execution_count": 6, |
| 116 | + "execution_count": null, |
132 | 117 | "metadata": {},
|
133 | 118 | "outputs": [],
|
134 | 119 | "source": [
|
|
144 | 129 | },
|
145 | 130 | {
|
146 | 131 | "cell_type": "code",
|
147 |
| - "execution_count": 7, |
| 132 | + "execution_count": null, |
148 | 133 | "metadata": {},
|
149 |
| - "outputs": [ |
150 |
| - { |
151 |
| - "data": { |
152 |
| - "text/plain": [ |
153 |
| - "['La', 'Nd']" |
154 |
| - ] |
155 |
| - }, |
156 |
| - "execution_count": 7, |
157 |
| - "metadata": {}, |
158 |
| - "output_type": "execute_result" |
159 |
| - } |
160 |
| - ], |
| 134 | + "outputs": [], |
161 | 135 | "source": [
|
162 | 136 | "widget.get_elements_by_state(0)"
|
163 | 137 | ]
|
|
178 | 152 | },
|
179 | 153 | {
|
180 | 154 | "cell_type": "code",
|
181 |
| - "execution_count": 8, |
| 155 | + "execution_count": null, |
182 | 156 | "metadata": {},
|
183 |
| - "outputs": [ |
184 |
| - { |
185 |
| - "data": { |
186 |
| - "application/vnd.jupyter.widget-view+json": { |
187 |
| - "model_id": "f658caea21644cbba8d8c05a099079d5", |
188 |
| - "version_major": 2, |
189 |
| - "version_minor": 0 |
190 |
| - }, |
191 |
| - "text/plain": [ |
192 |
| - "VBox(children=(Button(button_style='success', description='Get the currently selected values', layout=Layout(w…" |
193 |
| - ] |
194 |
| - }, |
195 |
| - "metadata": {}, |
196 |
| - "output_type": "display_data" |
197 |
| - } |
198 |
| - ], |
| 157 | + "outputs": [], |
199 | 158 | "source": [
|
200 | 159 | "output = widgets.Output()\n",
|
201 | 160 | "\n",
|
|
225 | 184 | },
|
226 | 185 | {
|
227 | 186 | "cell_type": "code",
|
228 |
| - "execution_count": 9, |
| 187 | + "execution_count": null, |
229 | 188 | "metadata": {},
|
230 |
| - "outputs": [ |
231 |
| - { |
232 |
| - "data": { |
233 |
| - "application/vnd.jupyter.widget-view+json": { |
234 |
| - "model_id": "1b169901f3fd42b59182d7772e0f0384", |
235 |
| - "version_major": 2, |
236 |
| - "version_minor": 0 |
237 |
| - }, |
238 |
| - "text/plain": [ |
239 |
| - "Checkbox(value=False, description='Disable oxygen')" |
240 |
| - ] |
241 |
| - }, |
242 |
| - "metadata": {}, |
243 |
| - "output_type": "display_data" |
244 |
| - } |
245 |
| - ], |
| 189 | + "outputs": [], |
246 | 190 | "source": [
|
247 | 191 | "toggle_disabled = widgets.Checkbox(\n",
|
248 | 192 | " value=\"O\" in widget.disabled_elements,\n",
|
|
277 | 221 | },
|
278 | 222 | {
|
279 | 223 | "cell_type": "code",
|
280 |
| - "execution_count": 10, |
| 224 | + "execution_count": null, |
281 | 225 | "metadata": {},
|
282 |
| - "outputs": [ |
283 |
| - { |
284 |
| - "data": { |
285 |
| - "application/vnd.jupyter.widget-view+json": { |
286 |
| - "model_id": "fc3d79d12d76454a8250a602de665f81", |
287 |
| - "version_major": 2, |
288 |
| - "version_minor": 0 |
289 |
| - }, |
290 |
| - "text/plain": [ |
291 |
| - "Checkbox(value=False, description='Freeze periodic table:')" |
292 |
| - ] |
293 |
| - }, |
294 |
| - "metadata": {}, |
295 |
| - "output_type": "display_data" |
296 |
| - } |
297 |
| - ], |
| 226 | + "outputs": [], |
298 | 227 | "source": [
|
299 | 228 | "toggle_freeze = widgets.Checkbox(\n",
|
300 | 229 | " value= False,\n",
|
|
321 | 250 | },
|
322 | 251 | {
|
323 | 252 | "cell_type": "code",
|
324 |
| - "execution_count": 11, |
| 253 | + "execution_count": null, |
325 | 254 | "metadata": {},
|
326 |
| - "outputs": [ |
327 |
| - { |
328 |
| - "data": { |
329 |
| - "application/vnd.jupyter.widget-view+json": { |
330 |
| - "model_id": "f29cb7d4e8fc49ed9aefc9e1ae8761d6", |
331 |
| - "version_major": 2, |
332 |
| - "version_minor": 0 |
333 |
| - }, |
334 |
| - "text/plain": [ |
335 |
| - "Button(button_style='success', description='Select only Li and H (from python)', layout=Layout(width='300px'),…" |
336 |
| - ] |
337 |
| - }, |
338 |
| - "metadata": {}, |
339 |
| - "output_type": "display_data" |
340 |
| - } |
341 |
| - ], |
| 255 | + "outputs": [], |
342 | 256 | "source": [
|
343 | 257 | "def on_set_from_python(event):\n",
|
344 | 258 | " # NOTE! If you put an element which does not exist, it will stay forever in the list, but it's ignored\n",
|
|
364 | 278 | },
|
365 | 279 | {
|
366 | 280 | "cell_type": "code",
|
367 |
| - "execution_count": 12, |
| 281 | + "execution_count": null, |
368 | 282 | "metadata": {},
|
369 |
| - "outputs": [ |
370 |
| - { |
371 |
| - "data": { |
372 |
| - "application/vnd.jupyter.widget-view+json": { |
373 |
| - "model_id": "b61605d0b08345f19f8344d3761b9677", |
374 |
| - "version_major": 2, |
375 |
| - "version_minor": 0 |
376 |
| - }, |
377 |
| - "text/plain": [ |
378 |
| - "Button(button_style='success', description='Make noble gases bold', layout=Layout(width='300px'), style=Button…" |
379 |
| - ] |
380 |
| - }, |
381 |
| - "metadata": {}, |
382 |
| - "output_type": "display_data" |
383 |
| - } |
384 |
| - ], |
| 283 | + "outputs": [], |
385 | 284 | "source": [
|
386 | 285 | "def get_noble_gases_state():\n",
|
387 | 286 | " label_deactivate = \"Make noble gases bold\"\n",
|
|
444 | 343 | "name": "python",
|
445 | 344 | "nbconvert_exporter": "python",
|
446 | 345 | "pygments_lexer": "ipython3",
|
447 |
| - "version": "3.9.7" |
| 346 | + "version": "3.11.5" |
448 | 347 | },
|
449 | 348 | "voila": {
|
450 | 349 | "authors": "Dou Du, Casper Welzel Andersen and Giovanni Pizzi"
|
|
0 commit comments