import holoviews as hv import panel as pn from bokeh.themes.theme import Theme hv.extension("bokeh") hv.renderer('bokeh').theme = Theme(json={}) # Reset Theme pn.extension() fonts_html = """ """ pn.pane.HTML(fonts_html, height=0, width=0, sizing_mode="fixed", margin=0) modules_html = """ """ pn.pane.HTML(modules_html, height=0, width=0, sizing_mode="fixed", margin=0) example_html = """
Material App
Panel App using Custom Template

Main Content!

""" pn.pane.HTML(example_html, sizing_mode="stretch_width", height=300) grid_import_html = """ """ pn.pane.HTML(grid_import_html, height=0, width=0, sizing_mode="fixed", margin=0) grid_example_html = """
""" pn.pane.Markdown(grid_example_html, sizing_mode="stretch_width", height=500) template = """ {% extends base %} {% block postamble %} {% endblock %} {% block contents %} {{ app_title }} subtitle
{{ app_title }}
{{ embed(roots.Styles) }}

Content!

This is a Panel app using a custom template based on Material Design. It works both in the Notebook and as a web app.


{{ embed(roots.G) }}
{{ embed(roots.A) }}
{{ embed(roots.B) }}
{{ embed(roots.C) }}
{{ embed(roots.D) }}
{{ embed(roots.E) }}
{{ embed(roots.F) }}
{% endblock %} """ # The style_panel supports incrementally adding css in cells below for educational reasons style_panel = pn.pane.HTML("", height=0, width=0, sizing_mode="fixed", margin=0) tmpl = pn.Template(template=template) tmpl.add_variable('app_title', 'Panel App using Custom Template') material_green = "rgb(0, 128, 0)" material_purple= "#9C27B0" color = material_green line_width=4 tmpl.add_panel('A', hv.Curve([1, 2, 3]).opts(height=200,color=color, line_width=line_width, responsive=True)) tmpl.add_panel('B', hv.Curve([1, 2, 3]).opts(height=200,color=color, line_width=line_width, responsive=True)) tmpl.add_panel('C', hv.Curve([1, 2, 3]).opts(height=200,color=color, line_width=line_width, responsive=True)) tmpl.add_panel('D', hv.Curve([1, 2, 3]).opts(height=200,color=color, line_width=line_width, responsive=True)) tmpl.add_panel('E', hv.Curve([1, 2, 3]).opts(height=200,color=color, line_width=line_width, responsive=True)) tmpl.add_panel('F', hv.Curve([1, 2, 3]).opts(height=200,color=color, line_width=line_width, responsive=True)) tmpl.add_panel('G', hv.Curve([1, 2, 3]).opts(height=200,color=color, line_width=line_width, responsive=True)) tmpl.add_panel('Styles', style_panel) tmpl def show_in_server(event): tmpl.show() show_in_server_button = pn.widgets.Button(name="Show in server") show_in_server_button.on_click(show_in_server) show_in_server_button dark_theme_style = """