{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "157994cc", "metadata": {}, "outputs": [], "source": [ "import mercury as mr" ] }, { "cell_type": "code", "execution_count": 2, "id": "f2970759", "metadata": {}, "outputs": [ { "data": { "application/mercury+json": "{\n \"widget\": \"App\",\n \"title\": \"MultiSelect\",\n \"description\": \"Demo of MutiSelect widget\",\n \"show_code\": true,\n \"show_prompt\": false,\n \"output\": \"app\",\n \"schedule\": \"\",\n \"notify\": \"{}\",\n \"continuous_update\": true,\n \"static_notebook\": false,\n \"show_sidebar\": true,\n \"full_screen\": true,\n \"allow_download\": true,\n \"model_id\": \"mercury-app\",\n \"code_uid\": \"App.0.40.24.1-rand52ff8045\"\n}", "text/html": [ "

Mercury Application

This output won't appear in the web app." ], "text/plain": [ "mercury.App" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "app = mr.App(title=\"MultiSelect\", description=\"Demo of MutiSelect widget\", show_code=True)" ] }, { "cell_type": "code", "execution_count": 3, "id": "e799cfd3", "metadata": {}, "outputs": [ { "data": { "application/mercury+json": "{\n \"widget\": \"MultiSelect\",\n \"value\": [\n \"a\",\n \"b\"\n ],\n \"choices\": [\n \"a\",\n \"b\",\n \"c\",\n \"d\",\n \"e\"\n ],\n \"label\": \"Please select letters\",\n \"model_id\": \"4bd323cd1655481fbda0eda5adef7a61\",\n \"code_uid\": \"MultiSelect.0.40.16.1-rand84903bec\",\n \"url_key\": \"selected\",\n \"disabled\": false,\n \"hidden\": false\n}", "application/vnd.jupyter.widget-view+json": { "model_id": "4bd323cd1655481fbda0eda5adef7a61", "version_major": 2, "version_minor": 0 }, "text/plain": [ "mercury.MultiSelect" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "selected = mr.MultiSelect(label=\"Please select letters\", \n", " value=[\"a\", \"b\"], \n", " choices=[\"a\", \"b\", \"c\", \"d\", \"e\"],\n", " url_key=\"selected\")" ] }, { "cell_type": "code", "execution_count": 4, "id": "86a9e273", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['a', 'b']\n" ] } ], "source": [ "print(selected.value)" ] } ], "metadata": { "kernelspec": { "display_name": "mex", "language": "python", "name": "mex" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.10" } }, "nbformat": 4, "nbformat_minor": 5 }