Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -30,22 +30,23 @@ filter_list = pn.widgets.MultiChoice(
|
|
| 30 |
button_type='default'
|
| 31 |
)
|
| 32 |
|
| 33 |
-
#
|
| 34 |
-
|
| 35 |
|
| 36 |
-
# Callback for
|
| 37 |
-
def
|
| 38 |
selected_option = filter_list.value
|
| 39 |
if selected_option:
|
| 40 |
-
|
| 41 |
-
|
|
|
|
| 42 |
|
| 43 |
-
|
| 44 |
|
| 45 |
# Layout using Template
|
| 46 |
template = pn.template.FastListTemplate(
|
| 47 |
title="EasySciRead",
|
| 48 |
-
header=[pn.Row(filter_list,
|
| 49 |
sidebar=[buttons],
|
| 50 |
main=[
|
| 51 |
pn.Column(text),
|
|
|
|
| 30 |
button_type='default'
|
| 31 |
)
|
| 32 |
|
| 33 |
+
# Create buttons for the header
|
| 34 |
+
header_buttons = []
|
| 35 |
|
| 36 |
+
# Callback for adding selected option to the header as a button
|
| 37 |
+
def add_to_header(event):
|
| 38 |
selected_option = filter_list.value
|
| 39 |
if selected_option:
|
| 40 |
+
new_button = pn.widgets.Button(name=selected_option[0], width=130, sizing_mode='fixed')
|
| 41 |
+
header_buttons.append(new_button)
|
| 42 |
+
filter_list.value = [] # Clear the selected option after adding it to the header
|
| 43 |
|
| 44 |
+
filter_list.param.watch(add_to_header, 'value')
|
| 45 |
|
| 46 |
# Layout using Template
|
| 47 |
template = pn.template.FastListTemplate(
|
| 48 |
title="EasySciRead",
|
| 49 |
+
header=[pn.Row(filter_list), pn.Row(header_buttons, sizing_mode='stretch_width')],
|
| 50 |
sidebar=[buttons],
|
| 51 |
main=[
|
| 52 |
pn.Column(text),
|