|
55 | 55 | "widgets.__version__"
|
56 | 56 | ]
|
57 | 57 | },
|
| 58 | + { |
| 59 | + "cell_type": "markdown", |
| 60 | + "id": "5581d1e1-e089-4076-941e-872229071f4d", |
| 61 | + "metadata": {}, |
| 62 | + "source": [ |
| 63 | + "#### Latest documentation here: https://ipywidgets.readthedocs.io/en/latest/index.html" |
| 64 | + ] |
| 65 | + }, |
58 | 66 | {
|
59 | 67 | "cell_type": "markdown",
|
60 | 68 | "id": "a407df5a-d525-46f7-adf2-fac35c2b9d8a",
|
|
211 | 219 | "slider"
|
212 | 220 | ]
|
213 | 221 | },
|
| 222 | + { |
| 223 | + "cell_type": "markdown", |
| 224 | + "id": "5069c5a9-3511-405c-b408-21108772baf0", |
| 225 | + "metadata": {}, |
| 226 | + "source": [ |
| 227 | + "#### New implementation of `FileUpload` widget\n", |
| 228 | + "* New representation of `.value` traitlet\n", |
| 229 | + "* Files represented as `memoryview` (can be saved to file system)\n", |
| 230 | + "* The `.data` traitlet has been removed.\n", |
| 231 | + "* The `.metadata` traitlet has been removed." |
| 232 | + ] |
| 233 | + }, |
| 234 | + { |
| 235 | + "cell_type": "code", |
| 236 | + "execution_count": null, |
| 237 | + "id": "87b55325-56e1-4d88-b266-0f30bf5fc764", |
| 238 | + "metadata": {}, |
| 239 | + "outputs": [], |
| 240 | + "source": [ |
| 241 | + "from ipywidgets import FileUpload\n", |
| 242 | + "\n", |
| 243 | + "fileupload = FileUpload(multiple=True)\n", |
| 244 | + "fileupload" |
| 245 | + ] |
| 246 | + }, |
| 247 | + { |
| 248 | + "cell_type": "code", |
| 249 | + "execution_count": null, |
| 250 | + "id": "594948f5-32ad-464e-8429-31a52e40b5a2", |
| 251 | + "metadata": {}, |
| 252 | + "outputs": [], |
| 253 | + "source": [ |
| 254 | + "# fileupload.value" |
| 255 | + ] |
| 256 | + }, |
| 257 | + { |
| 258 | + "cell_type": "code", |
| 259 | + "execution_count": null, |
| 260 | + "id": "296e0340-322a-4611-87bc-11e477563fb1", |
| 261 | + "metadata": {}, |
| 262 | + "outputs": [], |
| 263 | + "source": [ |
| 264 | + "# Text file\n", |
| 265 | + "# import codecs\n", |
| 266 | + "# print(codecs.decode(fileupload.value[0].content))" |
| 267 | + ] |
| 268 | + }, |
| 269 | + { |
| 270 | + "cell_type": "code", |
| 271 | + "execution_count": null, |
| 272 | + "id": "18f077d9-d133-4d9e-9f0c-8816a3b85f9c", |
| 273 | + "metadata": {}, |
| 274 | + "outputs": [], |
| 275 | + "source": [ |
| 276 | + "# from ipywidgets import Image\n", |
| 277 | + "# Image(value=fileupload.value[1].content.tobytes())" |
| 278 | + ] |
| 279 | + }, |
214 | 280 | {
|
215 | 281 | "cell_type": "markdown",
|
216 | 282 | "id": "709e5005-1569-4232-a618-5bde081247db",
|
|
226 | 292 | "metadata": {},
|
227 | 293 | "outputs": [],
|
228 | 294 | "source": [
|
229 |
| - "from ipywidgets import FileUpload\n", |
230 |
| - "\n", |
231 | 295 | "fileupload = FileUpload(tooltip='Upload a file because this tooltip says so')\n",
|
232 | 296 | "fileupload"
|
233 | 297 | ]
|
|
0 commit comments