{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "d663ab3e", "metadata": {}, "outputs": [ { "data": { "application/mercury+json": "{\n \"widget\": \"App\",\n \"title\": \"Mercury Test\",\n \"description\": \"Testing a basic notebook\",\n \"show_code\": false,\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.3-randede21b05\"\n}", "text/html": [ "

Mercury Application

This output won't appear in the web app." ], "text/plain": [ "mercury.App" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/mercury+json": "{\n \"widget\": \"Range\",\n \"value\": [\n 0,\n 1\n ],\n \"min\": 0,\n \"max\": 10,\n \"step\": 1,\n \"label\": \"\",\n \"model_id\": \"e86a831fbd9d4aea8093e819969124b5\",\n \"code_uid\": \"Range.0.40.30.6-rand91e5df71\",\n \"url_key\": \"\",\n \"disabled\": false,\n \"hidden\": false\n}", "application/vnd.jupyter.widget-view+json": { "model_id": "e86a831fbd9d4aea8093e819969124b5", "version_major": 2, "version_minor": 0 }, "text/plain": [ "mercury.Range" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "Your range starts at 0 ends at 1\n" ] } ], "source": [ "import mercury as mr\n", "\n", "app = mr.App(title=\"Mercury Test\", description=\"Testing a basic notebook\")\n", "\n", "# add range widget\n", "your_range = mr.Range(value=[0, 1], min=0, max=10, label=\"\", step=1)\n", " \n", "# access widget value in the code\n", "print(f\"Your range starts at {your_range.value[0]} ends at {your_range.value[1]}\")" ] }, { "cell_type": "code", "execution_count": null, "id": "2fa46b95", "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 }