{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "a53d11d9", "metadata": {}, "outputs": [], "source": [ "import mercury as mr" ] }, { "cell_type": "code", "execution_count": 2, "id": "3142a78a", "metadata": {}, "outputs": [], "source": [ "counter = 0" ] }, { "cell_type": "code", "execution_count": 3, "id": "8bab367e", "metadata": {}, "outputs": [ { "data": { "application/mercury+json": "{\n \"widget\": \"Select\",\n \"value\": \"a\",\n \"choices\": [\n \"a\",\n \"b\",\n \"c\"\n ],\n \"label\": \"\",\n \"model_id\": \"a7c71701e0944b70b44f13d6210e2a56\",\n \"code_uid\": \"Select.0.40.16.1-randd80902cc\",\n \"url_key\": \"\",\n \"disabled\": false,\n \"hidden\": false\n}", "application/vnd.jupyter.widget-view+json": { "model_id": "a7c71701e0944b70b44f13d6210e2a56", "version_major": 2, "version_minor": 0 }, "text/plain": [ "mercury.Select" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "d1 = mr.Select(value = \"a\", choices=[\"a\",\"b\",\"c\"])" ] }, { "cell_type": "code", "execution_count": 4, "id": "b6f16a37", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Counter 0\n", "Selection a\n" ] } ], "source": [ "print(f\"Counter {counter}\")\n", "print(f\"Selection {d1.value}\")\n", "counter += 1" ] }, { "cell_type": "code", "execution_count": 5, "id": "3a6950ed", "metadata": {}, "outputs": [ { "data": { "application/mercury+json": "{\n \"widget\": \"Select\",\n \"value\": \"BIG\",\n \"choices\": [\n \"small\",\n \"BIG\"\n ],\n \"label\": \"\",\n \"model_id\": \"5888d335978e48fd94ec92d526941827\",\n \"code_uid\": \"Select.0.40.16.1-randc7fe0bab\",\n \"url_key\": \"\",\n \"disabled\": false,\n \"hidden\": false\n}", "application/vnd.jupyter.widget-view+json": { "model_id": "5888d335978e48fd94ec92d526941827", "version_major": 2, "version_minor": 0 }, "text/plain": [ "mercury.Select" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "d2 = mr.Select(value = \"BIG\", choices=[\"small\", \"BIG\"])" ] }, { "cell_type": "code", "execution_count": 6, "id": "2494b6df", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Counter 1\n", "d2 selection BIG\n" ] } ], "source": [ "print(f\"Counter {counter}\")\n", "print(f\"d2 selection {d2.value}\")" ] }, { "cell_type": "code", "execution_count": null, "id": "a3367f2e", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "menv", "language": "python", "name": "menv" }, "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 }