{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import panel as pn\n", "\n", "pn.extension()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The ``Str`` pane allows rendering arbitrary text in a panel.\n", "\n", "Unlike [``Markdown``](Markdown.ipynb) and [``HTML``](HTML.ipynb) panes, a ``Str`` pane is interpreted as a raw string without applying any markup and is displayed in a fixed-width font by default.\n", "\n", "The pane will render any text, and if given an `object` will display the `object`'s Python `repr`.\n", "\n", "#### Parameters:\n", "\n", "For details on other options for customizing the component see the [layout](../../how_to/layout/index.md) and [styling](../../how_to/styling/index.md) how-to guides.\n", "\n", "* **``object``** (str or object): The string to display. If a non-string type is supplied, the `repr` of that object is displayed. \n", "* **``styles``** (dict): Dictionary specifying CSS styles\n", "\n", "___" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "str_pane = pn.pane.Str(\n", " 'This is a raw string which will not be formatted in any way except for the applied style.',\n", " styles={'font-size': '12pt'}\n", ")\n", "\n", "str_pane" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Like other panes the ``Str`` pane can be updated by setting its ``object`` parameter. As mentioned above, non-string types are automatically cast to a string:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "str_pane.object = 1.3234232" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Lets change the `object` back to its initial value:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "str_pane.object = 'This is a raw string which will not be formatted in any way except for the applied style.'" ] } ], "metadata": { "language_info": { "name": "python", "pygments_lexer": "ipython3" } }, "nbformat": 4, "nbformat_minor": 2 }