{ "cells": [ { "cell_type": "code", "execution_count": null, "id": "a17a3277", "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": "44fa382c", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "# Interactive presentation 📝" ] }, { "cell_type": "markdown", "id": "eb27c85b", "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": "86c79f3e", "metadata": { "slideshow": { "slide_type": "skip" } }, "outputs": [], "source": [ "name = mr.Text(label=\"What is your name?\", value=\"Piotr\")" ] }, { "cell_type": "code", "execution_count": null, "id": "c5f30726", "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": "3c6a0cb4", "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": "1b4f4408", "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": "017d36e9", "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 }