Spaces:
Sleeping
Sleeping
Update app3.py
Browse files
app3.py
CHANGED
|
@@ -1,40 +1,51 @@
|
|
| 1 |
import panel as pn
|
| 2 |
|
| 3 |
-
# Create a Panel app with centered title
|
| 4 |
-
title = pn.pane.HTML("<h1 style='text-align: center;'>My Panel App</h1>", width=300)
|
| 5 |
-
|
| 6 |
-
# Create a toggleable sidebar with three horizontal lines icon
|
| 7 |
-
toggle_sidebar = pn.widgets.Button(name='☰', button_type='primary', width=30, height=30)
|
| 8 |
-
toggle_sidebar.js_on_click(args={'sidebar': toggle_sidebar}, code="""
|
| 9 |
-
if (sidebar.width == 0) {
|
| 10 |
-
sidebar.width = 200;
|
| 11 |
-
buttons.css_classes = ['visible'];
|
| 12 |
-
} else {
|
| 13 |
-
sidebar.width = 0;
|
| 14 |
-
buttons.css_classes = ['hidden'];
|
| 15 |
-
}
|
| 16 |
-
""")
|
| 17 |
|
| 18 |
# Create buttons for the toggleable sidebar
|
| 19 |
-
button1 = pn.widgets.Button(
|
| 20 |
-
button2 = pn.widgets.Button(name='
|
| 21 |
-
button3 = pn.widgets.Button(
|
|
|
|
| 22 |
|
| 23 |
# Create a column layout for the buttons inside the toggleable sidebar
|
| 24 |
-
buttons = pn.Column(button1, button2, button3, sizing_mode='
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
)
|
| 38 |
|
| 39 |
# Run the app
|
| 40 |
-
|
|
|
|
| 1 |
import panel as pn
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
# Create buttons for the toggleable sidebar
|
| 5 |
+
button1 = pn.widgets.Button(icon = 'home', name="Home", icon_size='2em', width=130)
|
| 6 |
+
button2 = pn.widgets.Button(icon = 'file-analytics', name='My papers', icon_size='2em', width=130)
|
| 7 |
+
button3 = pn.widgets.Button(icon = 'settings', icon_size='2em', name='Settings', width=130)
|
| 8 |
+
|
| 9 |
|
| 10 |
# Create a column layout for the buttons inside the toggleable sidebar
|
| 11 |
+
buttons = pn.Column(button1, button2, button3, sizing_mode='stretch_width', css_classes=['hidden'])
|
| 12 |
+
|
| 13 |
+
instructions = """
|
| 14 |
+
# Teste
|
| 15 |
+
Use the box-select and lasso-select tools to select a subset of penguins
|
| 16 |
+
and reveal more information about the selected subgroup through the power
|
| 17 |
+
of cross-filtering.
|
| 18 |
+
"""
|
| 19 |
+
|
| 20 |
+
# Add filter list row with spacing
|
| 21 |
+
filter_list = pn.widgets.CheckButtonGroup(
|
| 22 |
+
name='Filter Options',
|
| 23 |
+
options=["option1", "option2", "option3"],
|
| 24 |
+
button_type='success',
|
| 25 |
+
sizing_mode='fixed',
|
| 26 |
+
button_style = 'solid',
|
| 27 |
+
# button_type = 'default',
|
| 28 |
+
margin=(5, 10)
|
| 29 |
+
)
|
| 30 |
+
|
| 31 |
+
text = pn.pane.Markdown(instructions)
|
| 32 |
+
|
| 33 |
+
# Layout using Template
|
| 34 |
+
template = pn.template.FastListTemplate(
|
| 35 |
+
title="EasySciRead",
|
| 36 |
+
sidebar=[buttons],
|
| 37 |
+
header=[filter_list],
|
| 38 |
+
main=[
|
| 39 |
+
pn.Row(filter_list, sizing_mode='stretch_width'), # Filter list row before the text
|
| 40 |
+
pn.Column(text),
|
| 41 |
+
],
|
| 42 |
+
accent_base_color="#88d8b0",
|
| 43 |
+
header_background="#FFFFFF",
|
| 44 |
+
header_color = "#000000",
|
| 45 |
+
text_align = 'center',
|
| 46 |
+
sidebar_width = 150
|
| 47 |
+
|
| 48 |
)
|
| 49 |
|
| 50 |
# Run the app
|
| 51 |
+
template.servable()
|