Skip to content

Commit 7592ada

Browse files
committedMay 25, 2022
widget_playground fixes
1 parent 3ed2c61 commit 7592ada

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed
 

‎examples/widgets_playground.ipynb

+12-10
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
"metadata": {},
1818
"outputs": [],
1919
"source": [
20-
"!pip install --quiet ipywidgets"
20+
"import subprocess\n",
21+
"for package in ('ipywidgets', 'matplotlib'):\n",
22+
" subprocess.check_call([sys.executable, \"-m\", \"pip\", \"install\", \"--quiet\", package])"
2123
]
2224
},
2325
{
@@ -26,12 +28,10 @@
2628
"metadata": {},
2729
"outputs": [],
2830
"source": [
29-
"import PyPartMC as ppmc\n",
3031
"from ipywidgets import Tab, SelectMultiple, IntSlider, FloatSlider, HTML, HBox, VBox, Output\n",
3132
"from matplotlib import pyplot\n",
32-
"from IPython.display import display, clear_output\n",
33-
"\n",
34-
"%matplotlib widget"
33+
"from IPython.display import display\n",
34+
"import PyPartMC as ppmc"
3535
]
3636
},
3737
{
@@ -40,14 +40,16 @@
4040
"metadata": {},
4141
"outputs": [],
4242
"source": [
43+
"%matplotlib widget\n",
44+
"\n",
4345
"if \"google.colab\" in sys.modules:\n",
44-
" hack = (\n",
46+
" HACK = (\n",
4547
" \"<link\"\n",
4648
" ' rel=\"stylesheet\"'\n",
4749
" ' href=\"https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css\"'\n",
4850
" \"> \"\n",
4951
" )\n",
50-
" display(HTML(hack))"
52+
" display(HTML(HACK))"
5153
]
5254
},
5355
{
@@ -126,7 +128,7 @@
126128
{
127129
"data": {
128130
"application/vnd.jupyter.widget-view+json": {
129-
"model_id": "1eeaf25a187441b0a2d4ff0e16158319",
131+
"model_id": "c9630f899d514ecb9c13641d56706dde",
130132
"version_major": 2,
131133
"version_minor": 0
132134
},
@@ -161,14 +163,14 @@
161163
},
162164
{
163165
"cell_type": "code",
164-
"execution_count": 13,
166+
"execution_count": 12,
165167
"metadata": {},
166168
"outputs": [
167169
{
168170
"name": "stdout",
169171
"output_type": "stream",
170172
"text": [
171-
"[\"H2SO4\",\"HNO3\",\"HCl\",\"NO\",\"NO2\"]\n"
173+
"[\"H2SO4\",\"HNO3\",\"HCl\",\"NH3\",\"NO\",\"NO2\"]\n"
172174
]
173175
}
174176
],

0 commit comments

Comments
 (0)