{ "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 RunMercury.com for more information 📚\n", "\n" ] } ], "metadata": {}, "nbformat": 4, "nbformat_minor": 5 }