|
2 | 2 | "cells": [
|
3 | 3 | {
|
4 | 4 | "cell_type": "code",
|
5 |
| - "execution_count": null, |
| 5 | + "execution_count": 1, |
6 | 6 | "metadata": {},
|
7 | 7 | "outputs": [],
|
8 | 8 | "source": [
|
|
19 | 19 | },
|
20 | 20 | {
|
21 | 21 | "cell_type": "code",
|
22 |
| - "execution_count": null, |
| 22 | + "execution_count": 2, |
23 | 23 | "metadata": {},
|
24 |
| - "outputs": [], |
| 24 | + "outputs": [ |
| 25 | + { |
| 26 | + "data": { |
| 27 | + "application/vnd.jupyter.widget-view+json": { |
| 28 | + "model_id": "312dc9bc4c7645ba8711de89900c888a", |
| 29 | + "version_major": 2, |
| 30 | + "version_minor": 0 |
| 31 | + }, |
| 32 | + "text/plain": [ |
| 33 | + "PTableWidget(noselect_color='blue', selected_colors=['red', 'green', 'yellow'], states=3)" |
| 34 | + ] |
| 35 | + }, |
| 36 | + "metadata": {}, |
| 37 | + "output_type": "display_data" |
| 38 | + } |
| 39 | + ], |
25 | 40 | "source": [
|
26 | 41 | "# Show the widget\n",
|
27 |
| - "widget = PTableWidget()\n", |
| 42 | + "widget = PTableWidget(states = 3, selected_colors = ['red', 'green', 'yellow'], noselect_color='blue')\n", |
28 | 43 | "widget"
|
29 | 44 | ]
|
30 | 45 | },
|
|
44 | 59 | },
|
45 | 60 | {
|
46 | 61 | "cell_type": "code",
|
47 |
| - "execution_count": null, |
| 62 | + "execution_count": 3, |
48 | 63 | "metadata": {},
|
49 |
| - "outputs": [], |
| 64 | + "outputs": [ |
| 65 | + { |
| 66 | + "data": { |
| 67 | + "application/vnd.jupyter.widget-view+json": { |
| 68 | + "model_id": "9f716d75f43f46e0913e2b4e19f04f04", |
| 69 | + "version_major": 2, |
| 70 | + "version_minor": 0 |
| 71 | + }, |
| 72 | + "text/plain": [ |
| 73 | + "VBox(children=(Button(button_style='success', description='Get the currently selected values', layout=Layout(w…" |
| 74 | + ] |
| 75 | + }, |
| 76 | + "metadata": {}, |
| 77 | + "output_type": "display_data" |
| 78 | + } |
| 79 | + ], |
50 | 80 | "source": [
|
51 | 81 | "output = widgets.Output()\n",
|
52 | 82 | "\n",
|
|
76 | 106 | },
|
77 | 107 | {
|
78 | 108 | "cell_type": "code",
|
79 |
| - "execution_count": null, |
| 109 | + "execution_count": 4, |
80 | 110 | "metadata": {},
|
81 |
| - "outputs": [], |
| 111 | + "outputs": [ |
| 112 | + { |
| 113 | + "data": { |
| 114 | + "application/vnd.jupyter.widget-view+json": { |
| 115 | + "model_id": "ba9d09402e0c43fe95a68fcb72561881", |
| 116 | + "version_major": 2, |
| 117 | + "version_minor": 0 |
| 118 | + }, |
| 119 | + "text/plain": [ |
| 120 | + "Checkbox(value=False, description='Disable oxygen')" |
| 121 | + ] |
| 122 | + }, |
| 123 | + "metadata": {}, |
| 124 | + "output_type": "display_data" |
| 125 | + } |
| 126 | + ], |
82 | 127 | "source": [
|
83 | 128 | "toggle_disabled = widgets.Checkbox(\n",
|
84 | 129 | " value=\"O\" in widget.disabled_elements,\n",
|
|
114 | 159 | },
|
115 | 160 | {
|
116 | 161 | "cell_type": "code",
|
117 |
| - "execution_count": null, |
| 162 | + "execution_count": 5, |
118 | 163 | "metadata": {},
|
119 |
| - "outputs": [], |
| 164 | + "outputs": [ |
| 165 | + { |
| 166 | + "data": { |
| 167 | + "application/vnd.jupyter.widget-view+json": { |
| 168 | + "model_id": "24001f1755fe492c97818b9fb70cf517", |
| 169 | + "version_major": 2, |
| 170 | + "version_minor": 0 |
| 171 | + }, |
| 172 | + "text/plain": [ |
| 173 | + "Button(button_style='success', description='Select only Li and H (from python)', layout=Layout(width='300px'),…" |
| 174 | + ] |
| 175 | + }, |
| 176 | + "metadata": {}, |
| 177 | + "output_type": "display_data" |
| 178 | + } |
| 179 | + ], |
120 | 180 | "source": [
|
121 | 181 | "def on_set_from_ptyhon(event):\n",
|
122 | 182 | " # NOTE! If you put an element which does not exist, it will stay forever in the list, but it's ignored\n",
|
|
141 | 201 | },
|
142 | 202 | {
|
143 | 203 | "cell_type": "code",
|
144 |
| - "execution_count": null, |
| 204 | + "execution_count": 6, |
145 | 205 | "metadata": {},
|
146 |
| - "outputs": [], |
| 206 | + "outputs": [ |
| 207 | + { |
| 208 | + "data": { |
| 209 | + "application/vnd.jupyter.widget-view+json": { |
| 210 | + "model_id": "c99467dc0c284c1b9e4bb718730c8366", |
| 211 | + "version_major": 2, |
| 212 | + "version_minor": 0 |
| 213 | + }, |
| 214 | + "text/plain": [ |
| 215 | + "Button(button_style='success', description='Make noble gases bold', layout=Layout(width='300px'), style=Button…" |
| 216 | + ] |
| 217 | + }, |
| 218 | + "metadata": {}, |
| 219 | + "output_type": "display_data" |
| 220 | + } |
| 221 | + ], |
147 | 222 | "source": [
|
148 | 223 | "def get_noble_gases_state():\n",
|
149 | 224 | " label_deactivate = \"Make noble gases bold\"\n",
|
|
188 | 263 | "button_noble.on_click(on_toggle_noble_gases)\n",
|
189 | 264 | "button_noble"
|
190 | 265 | ]
|
| 266 | + }, |
| 267 | + { |
| 268 | + "cell_type": "markdown", |
| 269 | + "metadata": {}, |
| 270 | + "source": [ |
| 271 | + "This work has been done with the support of the EPFL Open Science Fund [OSSCAR](http://www.osscar.org).\n", |
| 272 | + "\n", |
| 273 | + "<img src=\"http://www.osscar.org/wp-content/uploads/2019/03/OSSCAR-logo.png\" style=\"height:40px; width: 200px\"/>" |
| 274 | + ] |
191 | 275 | }
|
192 | 276 | ],
|
193 | 277 | "metadata": {
|
|
206 | 290 | "name": "python",
|
207 | 291 | "nbconvert_exporter": "python",
|
208 | 292 | "pygments_lexer": "ipython3",
|
209 |
| - "version": "3.8.1" |
| 293 | + "version": "3.8.2" |
210 | 294 | }
|
211 | 295 | },
|
212 | 296 | "nbformat": 4,
|
|
0 commit comments