|
11 | 11 | }, |
12 | 12 | { |
13 | 13 | "cell_type": "code", |
14 | | - "execution_count": 1, |
| 14 | + "execution_count": 25, |
15 | 15 | "metadata": {}, |
16 | | - "outputs": [], |
| 16 | + "outputs": [ |
| 17 | + { |
| 18 | + "name": "stderr", |
| 19 | + "output_type": "stream", |
| 20 | + "text": [ |
| 21 | + "WARNING: You are using pip version 21.2.3; however, version 22.1.2 is available.\n", |
| 22 | + "You should consider upgrading via the '/usr/local/bin/python3 -m pip install --upgrade pip' command.\n", |
| 23 | + "WARNING: You are using pip version 21.2.3; however, version 22.1.2 is available.\n", |
| 24 | + "You should consider upgrading via the '/usr/local/bin/python3 -m pip install --upgrade pip' command.\n" |
| 25 | + ] |
| 26 | + } |
| 27 | + ], |
17 | 28 | "source": [ |
18 | 29 | "import sys\n", |
19 | 30 | "import subprocess\n", |
|
31 | 42 | }, |
32 | 43 | { |
33 | 44 | "cell_type": "code", |
34 | | - "execution_count": 2, |
| 45 | + "execution_count": 26, |
35 | 46 | "metadata": {}, |
36 | 47 | "outputs": [], |
37 | 48 | "source": [ |
38 | | - "from ipywidgets import Tab, SelectMultiple, IntSlider, FloatSlider, HBox, VBox, Output\n", |
| 49 | + "from ipywidgets import Tab, SelectMultiple, IntSlider, FloatSlider, HBox, VBox, Output, Button\n", |
39 | 50 | "from matplotlib import pyplot\n", |
40 | 51 | "from IPython.display import display, clear_output\n", |
41 | 52 | "import PyPartMC as ppmc" |
42 | 53 | ] |
43 | 54 | }, |
44 | 55 | { |
45 | 56 | "cell_type": "code", |
46 | | - "execution_count": 3, |
| 57 | + "execution_count": null, |
| 58 | + "metadata": {}, |
| 59 | + "outputs": [], |
| 60 | + "source": [] |
| 61 | + }, |
| 62 | + { |
| 63 | + "cell_type": "code", |
| 64 | + "execution_count": 27, |
47 | 65 | "metadata": {}, |
48 | 66 | "outputs": [], |
49 | 67 | "source": [ |
|
53 | 71 | }, |
54 | 72 | { |
55 | 73 | "cell_type": "code", |
56 | | - "execution_count": 4, |
| 74 | + "execution_count": 28, |
57 | 75 | "metadata": {}, |
58 | 76 | "outputs": [], |
59 | 77 | "source": [ |
|
62 | 80 | }, |
63 | 81 | { |
64 | 82 | "cell_type": "code", |
65 | | - "execution_count": 5, |
| 83 | + "execution_count": 29, |
66 | 84 | "metadata": {}, |
67 | 85 | "outputs": [], |
68 | 86 | "source": [ |
69 | 87 | "param_x_widget = IntSlider(description='x [1]', min=1, max=9, value=2)\n", |
70 | | - "param_y_widget = IntSlider(description='y [1]', min=0, max=3, value=2)" |
| 88 | + "param_y_widget = IntSlider(description='y [1]', min=0, max=3, value=2)\n", |
| 89 | + "button = Button(description= 'Run')\n", |
| 90 | + "output = Output()" |
71 | 91 | ] |
72 | 92 | }, |
73 | 93 | { |
74 | 94 | "cell_type": "code", |
75 | | - "execution_count": 6, |
| 95 | + "execution_count": 30, |
76 | 96 | "metadata": {}, |
77 | 97 | "outputs": [], |
78 | 98 | "source": [ |
|
96 | 116 | }, |
97 | 117 | { |
98 | 118 | "cell_type": "code", |
99 | | - "execution_count": 7, |
| 119 | + "execution_count": 33, |
100 | 120 | "metadata": {}, |
101 | 121 | "outputs": [], |
102 | 122 | "source": [ |
|
112 | 132 | ")\n", |
113 | 133 | "tabs.set_title(0, \"GasData\")\n", |
114 | 134 | "tabs.set_title(1, \"Scenario\")\n", |
115 | | - "tabs.set_title(2, \"AeroState\")" |
| 135 | + "tabs.set_title(2, \"AeroState\")\n", |
| 136 | + "gui = VBox((tabs,button,output))\n", |
| 137 | + "def action(_):\n", |
| 138 | + " with output:\n", |
| 139 | + " clear_output(wait=True)\n", |
| 140 | + " print(param_x_widget.value, \",\", param_y_widget.value)\n", |
| 141 | + " gas_data = ppmc.GasData(gas_data_widget.value)\n", |
| 142 | + " print(gas_data)\n", |
| 143 | + "\n", |
| 144 | + "button.on_click(action)\n" |
116 | 145 | ] |
117 | 146 | }, |
118 | 147 | { |
119 | 148 | "cell_type": "code", |
120 | | - "execution_count": 8, |
| 149 | + "execution_count": 34, |
121 | 150 | "metadata": {}, |
122 | 151 | "outputs": [ |
123 | 152 | { |
124 | 153 | "data": { |
125 | 154 | "application/vnd.jupyter.widget-view+json": { |
126 | | - "model_id": "2e539a71b14b40c2b96933a5398b2fd9", |
| 155 | + "model_id": "761d1bf26db842a2b8f9c1bbc72234e6", |
127 | 156 | "version_major": 2, |
128 | 157 | "version_minor": 0 |
129 | 158 | }, |
130 | 159 | "text/plain": [ |
131 | | - "Tab(children=(SelectMultiple(index=(0, 1, 2, 3, 4, 5), options=('H2SO4', 'HNO3', 'HCl', 'NH3', 'NO', 'NO2'), v…" |
| 160 | + "VBox(children=(Tab(children=(SelectMultiple(index=(1,), options=('H2SO4', 'HNO3', 'HCl', 'NH3', 'NO', 'NO2'), …" |
132 | 161 | ] |
133 | 162 | }, |
134 | 163 | "metadata": {}, |
135 | 164 | "output_type": "display_data" |
136 | 165 | } |
137 | 166 | ], |
138 | 167 | "source": [ |
139 | | - "display(tabs)" |
| 168 | + "display(gui)" |
140 | 169 | ] |
141 | 170 | }, |
142 | 171 | { |
143 | 172 | "cell_type": "code", |
144 | | - "execution_count": 9, |
| 173 | + "execution_count": null, |
145 | 174 | "metadata": {}, |
146 | | - "outputs": [ |
147 | | - { |
148 | | - "name": "stdout", |
149 | | - "output_type": "stream", |
150 | | - "text": [ |
151 | | - "2 , 2\n" |
152 | | - ] |
153 | | - } |
154 | | - ], |
155 | | - "source": [ |
156 | | - "print(param_x_widget.value, \",\", param_y_widget.value)" |
157 | | - ] |
| 175 | + "outputs": [], |
| 176 | + "source": [] |
158 | 177 | }, |
159 | 178 | { |
160 | 179 | "cell_type": "code", |
161 | | - "execution_count": 10, |
| 180 | + "execution_count": null, |
162 | 181 | "metadata": {}, |
163 | | - "outputs": [ |
164 | | - { |
165 | | - "name": "stdout", |
166 | | - "output_type": "stream", |
167 | | - "text": [ |
168 | | - "[\"H2SO4\",\"HNO3\",\"HCl\",\"NH3\",\"NO\",\"NO2\"]\n" |
169 | | - ] |
170 | | - } |
171 | | - ], |
172 | | - "source": [ |
173 | | - "gas_data = ppmc.GasData(gas_data_widget.value)\n", |
174 | | - "print(gas_data)" |
175 | | - ] |
| 182 | + "outputs": [], |
| 183 | + "source": [] |
176 | 184 | }, |
177 | 185 | { |
178 | 186 | "cell_type": "code", |
|
191 | 199 | ], |
192 | 200 | "metadata": { |
193 | 201 | "kernelspec": { |
194 | | - "display_name": "Python 3", |
| 202 | + "display_name": "Python 3.10.0 64-bit", |
195 | 203 | "language": "python", |
196 | 204 | "name": "python3" |
197 | 205 | }, |
|
205 | 213 | "name": "python", |
206 | 214 | "nbconvert_exporter": "python", |
207 | 215 | "pygments_lexer": "ipython3", |
208 | | - "version": "3.8.7" |
| 216 | + "version": "3.10.0" |
| 217 | + }, |
| 218 | + "vscode": { |
| 219 | + "interpreter": { |
| 220 | + "hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49" |
| 221 | + } |
209 | 222 | } |
210 | 223 | }, |
211 | 224 | "nbformat": 4, |
|
0 commit comments