Spaces:
Sleeping
Sleeping
Update app2.py
Browse files
app2.py
CHANGED
|
@@ -29,18 +29,21 @@ button2 = pn.widgets.Button(icon='file-analytics', name='My papers', icon_size='
|
|
| 29 |
button3 = pn.widgets.Button(icon='settings', icon_size='1.5em', name='Settings', button_type = 'primary', button_style = 'outline', width = 140)
|
| 30 |
|
| 31 |
# Create binary slider buttons for the sidebar
|
| 32 |
-
|
| 33 |
-
toggle_button2 = pn.widgets.Toggle(name="Filter 2", on_text="filter3", off_text="filter4", width=140)
|
| 34 |
|
| 35 |
-
# Create Markdown
|
| 36 |
-
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
# Create a column layout for the buttons inside the toggleable sidebar
|
| 40 |
buttons = pn.Column(
|
| 41 |
button1, button2, button3,
|
| 42 |
-
pn.Row(
|
| 43 |
-
pn.Row(filter_name2, toggle_button2),
|
| 44 |
css_classes=['hidden']
|
| 45 |
)
|
| 46 |
|
|
|
|
| 29 |
button3 = pn.widgets.Button(icon='settings', icon_size='1.5em', name='Settings', button_type = 'primary', button_style = 'outline', width = 140)
|
| 30 |
|
| 31 |
# Create binary slider buttons for the sidebar
|
| 32 |
+
toggle_button = pn.widgets.Toggle(name="Filter", on_text="filter1", off_text="filter2", width=140)
|
|
|
|
| 33 |
|
| 34 |
+
# Create a Markdown pane to display the current filter name
|
| 35 |
+
filter_name = pn.pane.Markdown(toggle_button.on_text)
|
| 36 |
+
|
| 37 |
+
# Create a callback to update the filter name when the button is toggled
|
| 38 |
+
def update_filter_name(event):
|
| 39 |
+
filter_name.object = toggle_button.on_text
|
| 40 |
+
|
| 41 |
+
toggle_button.param.watch(update_filter_name, 'value')
|
| 42 |
|
| 43 |
# Create a column layout for the buttons inside the toggleable sidebar
|
| 44 |
buttons = pn.Column(
|
| 45 |
button1, button2, button3,
|
| 46 |
+
pn.Row(filter_name, toggle_button),
|
|
|
|
| 47 |
css_classes=['hidden']
|
| 48 |
)
|
| 49 |
|