pplonski commited on
Commit
a123edf
1 Parent(s): 03695eb

Upload 2 files

Browse files
Files changed (2) hide show
  1. dropdown bug.ipynb +146 -0
  2. range bug.ipynb +87 -0
dropdown bug.ipynb ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "a53d11d9",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "import mercury as mr"
11
+ ]
12
+ },
13
+ {
14
+ "cell_type": "code",
15
+ "execution_count": 2,
16
+ "id": "3142a78a",
17
+ "metadata": {},
18
+ "outputs": [],
19
+ "source": [
20
+ "counter = 0"
21
+ ]
22
+ },
23
+ {
24
+ "cell_type": "code",
25
+ "execution_count": 3,
26
+ "id": "8bab367e",
27
+ "metadata": {},
28
+ "outputs": [
29
+ {
30
+ "data": {
31
+ "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}",
32
+ "application/vnd.jupyter.widget-view+json": {
33
+ "model_id": "a7c71701e0944b70b44f13d6210e2a56",
34
+ "version_major": 2,
35
+ "version_minor": 0
36
+ },
37
+ "text/plain": [
38
+ "mercury.Select"
39
+ ]
40
+ },
41
+ "metadata": {},
42
+ "output_type": "display_data"
43
+ }
44
+ ],
45
+ "source": [
46
+ "d1 = mr.Select(value = \"a\", choices=[\"a\",\"b\",\"c\"])"
47
+ ]
48
+ },
49
+ {
50
+ "cell_type": "code",
51
+ "execution_count": 4,
52
+ "id": "b6f16a37",
53
+ "metadata": {},
54
+ "outputs": [
55
+ {
56
+ "name": "stdout",
57
+ "output_type": "stream",
58
+ "text": [
59
+ "Counter 0\n",
60
+ "Selection a\n"
61
+ ]
62
+ }
63
+ ],
64
+ "source": [
65
+ "print(f\"Counter {counter}\")\n",
66
+ "print(f\"Selection {d1.value}\")\n",
67
+ "counter += 1"
68
+ ]
69
+ },
70
+ {
71
+ "cell_type": "code",
72
+ "execution_count": 5,
73
+ "id": "3a6950ed",
74
+ "metadata": {},
75
+ "outputs": [
76
+ {
77
+ "data": {
78
+ "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}",
79
+ "application/vnd.jupyter.widget-view+json": {
80
+ "model_id": "5888d335978e48fd94ec92d526941827",
81
+ "version_major": 2,
82
+ "version_minor": 0
83
+ },
84
+ "text/plain": [
85
+ "mercury.Select"
86
+ ]
87
+ },
88
+ "metadata": {},
89
+ "output_type": "display_data"
90
+ }
91
+ ],
92
+ "source": [
93
+ "d2 = mr.Select(value = \"BIG\", choices=[\"small\", \"BIG\"])"
94
+ ]
95
+ },
96
+ {
97
+ "cell_type": "code",
98
+ "execution_count": 6,
99
+ "id": "2494b6df",
100
+ "metadata": {},
101
+ "outputs": [
102
+ {
103
+ "name": "stdout",
104
+ "output_type": "stream",
105
+ "text": [
106
+ "Counter 1\n",
107
+ "d2 selection BIG\n"
108
+ ]
109
+ }
110
+ ],
111
+ "source": [
112
+ "print(f\"Counter {counter}\")\n",
113
+ "print(f\"d2 selection {d2.value}\")"
114
+ ]
115
+ },
116
+ {
117
+ "cell_type": "code",
118
+ "execution_count": null,
119
+ "id": "a3367f2e",
120
+ "metadata": {},
121
+ "outputs": [],
122
+ "source": []
123
+ }
124
+ ],
125
+ "metadata": {
126
+ "kernelspec": {
127
+ "display_name": "menv",
128
+ "language": "python",
129
+ "name": "menv"
130
+ },
131
+ "language_info": {
132
+ "codemirror_mode": {
133
+ "name": "ipython",
134
+ "version": 3
135
+ },
136
+ "file_extension": ".py",
137
+ "mimetype": "text/x-python",
138
+ "name": "python",
139
+ "nbconvert_exporter": "python",
140
+ "pygments_lexer": "ipython3",
141
+ "version": "3.8.10"
142
+ }
143
+ },
144
+ "nbformat": 4,
145
+ "nbformat_minor": 5
146
+ }
range bug.ipynb ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "d663ab3e",
7
+ "metadata": {},
8
+ "outputs": [
9
+ {
10
+ "data": {
11
+ "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}",
12
+ "text/html": [
13
+ "<h3>Mercury Application</h3><small>This output won't appear in the web app.</small>"
14
+ ],
15
+ "text/plain": [
16
+ "mercury.App"
17
+ ]
18
+ },
19
+ "metadata": {},
20
+ "output_type": "display_data"
21
+ },
22
+ {
23
+ "data": {
24
+ "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}",
25
+ "application/vnd.jupyter.widget-view+json": {
26
+ "model_id": "e86a831fbd9d4aea8093e819969124b5",
27
+ "version_major": 2,
28
+ "version_minor": 0
29
+ },
30
+ "text/plain": [
31
+ "mercury.Range"
32
+ ]
33
+ },
34
+ "metadata": {},
35
+ "output_type": "display_data"
36
+ },
37
+ {
38
+ "name": "stdout",
39
+ "output_type": "stream",
40
+ "text": [
41
+ "Your range starts at 0 ends at 1\n"
42
+ ]
43
+ }
44
+ ],
45
+ "source": [
46
+ "import mercury as mr\n",
47
+ "\n",
48
+ "app = mr.App(title=\"Mercury Test\", description=\"Testing a basic notebook\")\n",
49
+ "\n",
50
+ "# add range widget\n",
51
+ "your_range = mr.Range(value=[0, 1], min=0, max=10, label=\"\", step=1)\n",
52
+ " \n",
53
+ "# access widget value in the code\n",
54
+ "print(f\"Your range starts at {your_range.value[0]} ends at {your_range.value[1]}\")"
55
+ ]
56
+ },
57
+ {
58
+ "cell_type": "code",
59
+ "execution_count": null,
60
+ "id": "2fa46b95",
61
+ "metadata": {},
62
+ "outputs": [],
63
+ "source": []
64
+ }
65
+ ],
66
+ "metadata": {
67
+ "kernelspec": {
68
+ "display_name": "menv",
69
+ "language": "python",
70
+ "name": "menv"
71
+ },
72
+ "language_info": {
73
+ "codemirror_mode": {
74
+ "name": "ipython",
75
+ "version": 3
76
+ },
77
+ "file_extension": ".py",
78
+ "mimetype": "text/x-python",
79
+ "name": "python",
80
+ "nbconvert_exporter": "python",
81
+ "pygments_lexer": "ipython3",
82
+ "version": "3.8.10"
83
+ }
84
+ },
85
+ "nbformat": 4,
86
+ "nbformat_minor": 5
87
+ }