{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# IntSlider" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import com.twosigma.beakerx.widget.IntSlider\n", "w = new IntSlider(value : 60)\n", "w" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "w.value" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "w.value = 76" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "w.description = \"desc1\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "w.disabled = true" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "w.disabled = false\n", "w.max = 250\n", "w.min = 50\n", "w.value = 150" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "w.orientation = \"vertical\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "w.step = 20\n", "w.value = 76" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "w.style.handle_color = \"#F04080\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# FloatSlider" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import com.twosigma.beakerx.widget.FloatSlider\n", "fs = new FloatSlider(value : 10.3)\n", "fs" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fs.value" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fs.value = 7.6" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fs.description = \"float\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fs.disabled = true" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fs.disabled = false\n", "fs.max = 2.50\n", "fs.step = 0.1\n", "fs.min = 0.5\n", "fs.value = 1.5" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fs.orientation = \"vertical\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fs.step = 0.2\n", "fs.value = 0.76" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fs.style.handle_color = \"#F04080\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# IntProgress" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import com.twosigma.beakerx.widget.IntProgress\n", "bar = new IntProgress(value : 60)\n", "bar" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "bar.value" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "bar.value = 76" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "bar.description = \"desc2\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "bar.max = 250\n", "bar.min = 50\n", "bar.value = 150" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "bar.orientation = \"vertical\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import com.twosigma.beakerx.widget.IntProgress\n", "bar.barStyle = IntProgress.BarStyle.SUCCESS" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# FloatProgress" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import com.twosigma.beakerx.widget.FloatProgress\n", "fbar = new FloatProgress(value : 10.3)\n", "fbar" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fbar.value" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fbar.value = 17.6" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fbar.description = \"fbar\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fbar.max = 2.5\n", "fbar.step = 0.1\n", "fbar.min = 0.5\n", "fbar.value = 1.5" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fbar.orientation = \"vertical\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# IntRangeSlider" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import com.twosigma.beakerx.widget.IntRangeSlider\n", "irs = new IntRangeSlider()\n", "irs.value = [10,40]\n", "irs" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "irs.value" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "irs.value = [20, 30]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "irs.description = \"desc3\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "irs.disabled = true" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "irs.disabled = false\n", "irs.max = 250\n", "irs.min = 50\n", "irs.value = [150, 200]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "irs.orientation = \"vertical\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "irs.step = 20\n", "irs.value = [76, 96]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "irs.style.handle_color = \"#F04080\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# FloatRangeSlider" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import com.twosigma.beakerx.widget.FloatRangeSlider\n", "frs = new FloatRangeSlider()\n", "frs.value = [10.3, 40.4]\n", "frs" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "frs.value" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "frs.value = [20.7, 30.8]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "frs.description = \"desc4\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "frs.disabled = true" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "frs.disabled = false\n", "frs.step = 0.1\n", "frs.max = 2.5\n", "frs.min = 0.5\n", "frs.value = [1.5, 2.0]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "frs.orientation = \"vertical\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "frs.step = 0.2\n", "frs.value = [0.76, 0.96]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "frs.style.handle_color = \"#F04080\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Output usage" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import com.twosigma.beakerx.widget.Output\n", "out = new Output()\n", "OutputManager.setOutput(new Output())\n", "out" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "for (i = 0; i <10; i++) {\n", " println(\"Hello \"+ i)\n", "}\n", "\"result loop\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "out.appendStdout(\"Hello 2\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "out.appendStderr(\"Error 1\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "System.err.println(\"Error 2\");" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "out.clearOutput()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "println(\"Hello 3\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import com.twosigma.beakerx.widget.IntSlider\n", "out.display(new IntSlider())" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "OutputManager.setOutput(null)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "println(\"Hello 6\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Only stdout" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import com.twosigma.beakerx.widget.Output\n", "OutputManager.setStandardOutput(new Output())" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "println(\"Hello only stdout\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "System.err.println(\"Error for onlyOut\");" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "OutputManager.clear()\n", "OutputManager.setStandardOutput(null)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Only stderr" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import com.twosigma.beakerx.widget.Output\n", "OutputManager.setStandardError(new Output())" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "println(\"Hello only stderr\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "System.err.println(\"Error for onlyErr\");" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "OutputManager.setStandardError(null)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Rich material can also be directed to the output area" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import com.twosigma.beakerx.widget.Output\n", "out2 = new Output()\n", "OutputManager.setOutput(out2)\n", "out2" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "println(\"before\")\n", "out2.display(YoutubeVideo(\"gSVvxOchT8Y\"))\n", "println(\"inside\")\n", "out2.display(SVG(\"https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/car.svg\"))\n", "println(\"after\")\n", "\"done\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "out2.display(YoutubeVideo(\"gSVvxOchT8Y\"))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "out2.clearOutput()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "OutputManager.setOutput(null)" ] } ], "metadata": { "kernelspec": { "display_name": "Groovy", "language": "groovy", "name": "groovy" }, "language_info": { "codemirror_mode": "groovy", "file_extension": ".groovy", "mimetype": "", "name": "Groovy", "nbconverter_exporter": "", "version": "2.4.3" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": false, "sideBar": false, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": false, "toc_window_display": false } }, "nbformat": 4, "nbformat_minor": 2 }