File size: 3,127 Bytes
524c2d2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "18f75bbd",
   "metadata": {
    "slideshow": {
     "slide_type": "skip"
    }
   },
   "outputs": [],
   "source": [
    "import mercury as mr\n",
    "import numpy as np\n",
    "from matplotlib import pyplot as plt\n",
    "\n",
    "app = mr.App(title=\"Slides demo πŸ“\", description=\"Wouldn't it be amazing to recompute slides during the show?\") "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b6406aef",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "# Interactive presentation πŸ“"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "356881ce",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Recompute slides πŸ–₯️\n",
    "\n",
    "- You can create interactive presentation with Mercury\n",
    "- Users can recompute slides by changing widgets\n",
    "- You can enter full screen by pressing **F** and exit with **Esc**\n",
    "- Please check next slides ➑️\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ab8b6a12",
   "metadata": {
    "slideshow": {
     "slide_type": "skip"
    }
   },
   "outputs": [],
   "source": [
    "name = mr.Text(label=\"What is your name?\", value=\"Piotr\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1e35109c",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "outputs": [],
   "source": [
    "mr.Markdown(f\"\"\"## Hello {name.value}!\n",
    "\n",
    "{name.value}, this slide is recomputed after name change in the left side bar.\n",
    "\n",
    "Please change the name value in the left side bar and press **Enter**.\n",
    "\n",
    "Please check next slide ➑️\n",
    "\n",
    "\"\"\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f73fb730",
   "metadata": {
    "slideshow": {
     "slide_type": "skip"
    }
   },
   "outputs": [],
   "source": [
    "samples = mr.Slider(label=\"How many samples\", value=75, min=50, max=100)\n",
    "color = mr.Select(label=\"Mark color\", value=\"blue\", choices=[\"blue\", \"green\", \"red\"])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "91b9e0a2",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "outputs": [],
   "source": [
    "mr.Markdown(\"\"\"## Scatter plot 🎲\n",
    "Please change number of samples and mark color in the left side bar. The plot will be updated during the slide show.\"\"\")\n",
    "_ = plt.plot(np.random.rand(samples.value), np.random.rand(samples.value), \"*\", color=color.value)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d90d721e",
   "metadata": {
    "slideshow": {
     "slide_type": "slide"
    }
   },
   "source": [
    "## Thank you!\n",
    "        \n",
    "Please check our documentation at <a href=\"https://runmercury.com\" target=\"_blank\">RunMercury.com</a> for more information πŸ“š\n",
    "\n"
   ]
  }
 ],
 "metadata": {},
 "nbformat": 4,
 "nbformat_minor": 5
}