EasySci commited on
Commit
35780ab
·
1 Parent(s): f482408

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -18,7 +18,7 @@ of cross-filtering.
18
  text = pn.pane.Markdown(instructions)
19
 
20
  # List to store the entered options
21
- entered_options = ["option1", "option2", "option3", "option4", "option6", "option7", "option8"]
22
 
23
  # MultiChoice widget to display the filter options
24
  filter_list = pn.widgets.MultiChoice(
@@ -33,23 +33,25 @@ filter_list = pn.widgets.MultiChoice(
33
  # Create buttons for the header
34
  header_buttons = pn.Column(sizing_mode='stretch_width', css_classes=['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
- header_buttons.append(pn.widgets.Button(name=selected_option[0], width=130, sizing_mode='fixed'))
 
41
  filter_list.value = [] # Clear the selected option after adding it to the header
42
 
43
- # "+" button to trigger the addition to the header
44
- add_to_header_button = pn.widgets.Button(name="Add to Header", button_type='primary')
45
  add_to_header_button.on_click(add_to_header)
46
 
47
  # Layout using Template
48
  template = pn.template.FastListTemplate(
49
  title="EasySciRead",
50
- header=[pn.Row(header_buttons,filter_list, add_to_header_button)],
51
  main=[
52
- # pn.Row(text),
53
  pn.Column(text),
54
  ],
55
  sidebar=[buttons],
 
18
  text = pn.pane.Markdown(instructions)
19
 
20
  # List to store the entered options
21
+ entered_options = ["option1", "option2", "option3"]
22
 
23
  # MultiChoice widget to display the filter options
24
  filter_list = pn.widgets.MultiChoice(
 
33
  # Create buttons for the header
34
  header_buttons = pn.Column(sizing_mode='stretch_width', css_classes=['header-buttons'])
35
 
36
+ # "+" button to trigger the addition to the header
37
+ add_to_header_button = pn.widgets.Button(name="Add to Header", button_type='primary')
38
+
39
  # Callback for adding selected option to the header as a button
40
  def add_to_header(event):
41
  selected_option = filter_list.value
42
  if selected_option:
43
+ new_button = pn.widgets.Button(name=selected_option[0], width=130, sizing_mode='fixed')
44
+ header_buttons.append(new_button)
45
  filter_list.value = [] # Clear the selected option after adding it to the header
46
 
 
 
47
  add_to_header_button.on_click(add_to_header)
48
 
49
  # Layout using Template
50
  template = pn.template.FastListTemplate(
51
  title="EasySciRead",
52
+ header=[pn.Row(filter_list, add_to_header_button)],
53
  main=[
54
+ pn.Row(header_buttons),
55
  pn.Column(text),
56
  ],
57
  sidebar=[buttons],