{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "![Callysto.ca Banner](https://github.com/callysto/curriculum-notebooks/blob/master/callysto-notebook-banner-top.jpg?raw=true)\n", "\n", "\"Open" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Including Geogebra\n", "\n", "Geogebra is an exciting application for doing geometry, albegra, and other mathematical exercises online. You access it here: https://www.geogebra.org/\n", "\n", "This notebook is not a tutorial on Geogebra; you'll need to figure that out yourself. Also **note** this probably doesn't work in a static Jupyter Book. You will need to run it in Callysto by clicking on the \"Open in Callysto\" button above.\n", "\n", "However, once you know how to make a Geogebra application, you can then include it into a Jupyter notebook. \n", "\n", "First step is to use the geogebra.org website to create your app, then export it (download it) as a .ggb file. \n", "\n", "Second step is to upload it onto the Jupyter hub, using the \"upload\" on the hub menu.\n", "\n", "Third, you set up some initialization in your Jupyter notebook, that looks like this:\n", "```\n", "%%html\n", "\n", "```\n", "\n", "Fourth, you now read in the file (in this case, names geo-test.ggb) into a cell in the Jupyter notebook, like this:\n", "```\n", "%%html\n", "
\n", "\n", "\n", "```\n", "\n", "You now will have a working Geogebra application running inside the Jupyter notebook. Note in the commands above, there are a bunch of true/false options for turning on and off various features in the Geogebra application. You can experiment with these until you get the right collection of options desired.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1\n", "\n", "First, we do the setup. Note the following is a \"code\" cell, not markdown. " ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%%html\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Next we load in the Geogebra app with the following code. Note the local file name here is geo-test.ggb. You will have to use the name of your file to get it to load. " ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%%html\n", "\n", "
\n", "\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 2\n", "\n", "Let's try this using the D3 example of how to do Javascript in a solid way. " ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "
\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from IPython.core.display import display, HTML\n", "\n", "html_text = '''\n", "
\n", "\n", "'''\n", "\n", "display(HTML(html_text))" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "
\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "
\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "
\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "## sometime we need to run this a few times!\n", "display(HTML(html_text))\n", "display(HTML(html_text))\n", "display(HTML(html_text))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Notes.\n", "\n", "In a Jupyter Book, the %%html script may not work. I don't know why.\n", "\n", "The display(HTML(...)) command seems to work better. But maybe you have to run it twice!" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "[![Callysto.ca License](https://github.com/callysto/curriculum-notebooks/blob/master/callysto-notebook-banner-bottom.jpg?raw=true)](https://github.com/callysto/curriculum-notebooks/blob/master/LICENSE.md)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "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.7.4" } }, "nbformat": 4, "nbformat_minor": 2 }