File size: 3,396 Bytes
a123edf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
{
 "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
}