Str#
Open this notebook in Jupyterlite | Download this notebook from GitHub (right-click to download).
import panel as pn
pn.extension()
The Str
pane allows rendering arbitrary text in a panel.
Unlike Markdown
and HTML
panes, a Str
pane is interpreted as a raw string without applying any markup and is displayed in a fixed-width font by default.
The pane will render any text, and if given an object
will display the object
’s Python repr
.
Parameters:#
For details on other options for customizing the component see the layout and styling how-to guides.
object
(str or object): The string to display. If a non-string type is supplied, therepr
of that object is displayed.style
(dict): Dictionary specifying CSS styles
str_pane = pn.pane.Str(
'This is a raw string which will not be formatted in any way except for the applied style.',
styles={'font-size': '12pt'}
)
str_pane
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:
str_pane.object = 1.3234232
Lets change the object
back to its initial value:
str_pane.object = 'This is a raw string which will not be formatted in any way except for the applied style.'
Open this notebook in Jupyterlite | Download this notebook from GitHub (right-click to download).