EasySci commited on
Commit
a92aaca
·
1 Parent(s): 2db7b1e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -10
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 = []
22
 
23
  # MultiChoice widget to display the filter options
24
  filter_list = pn.widgets.MultiChoice(
@@ -33,23 +33,19 @@ filter_list = pn.widgets.MultiChoice(
33
  # "+" button to show the search options
34
  add_option_button = pn.widgets.Button(icon='search', name="", icon_size='2em', width=60, height=30)
35
 
36
- # Create a TextInput widget to get new filter options from the user
37
- new_option_input = pn.widgets.TextInput(sizing_mode="stretch_width", background='lightgrey')
38
-
39
- # Callback for the "+" button to add the new option to the filter list
40
  def add_new_option(event):
41
- new_option = new_option_input.value.strip() # Remove leading/trailing spaces
42
- if new_option:
43
- entered_options.append(new_option) # Add the option to the list of entered options
44
  filter_list.options = entered_options # Update the filter_list options
45
- new_option_input.value = ""
46
 
47
  add_option_button.on_click(add_new_option)
48
 
49
  # Layout using Template
50
  template = pn.template.FastListTemplate(
51
  title="EasySciRead",
52
- header=[pn.Row(filter_list, add_option_button, new_option_input)],
53
  sidebar=[buttons],
54
  main=[
55
  pn.Column(text),
 
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
  # "+" button to show the search options
34
  add_option_button = pn.widgets.Button(icon='search', name="", icon_size='2em', width=60, height=30)
35
 
36
+ # Callback for the "+" button to add the selected option to the filter list
 
 
 
37
  def add_new_option(event):
38
+ selected_option = filter_list.value
39
+ if selected_option:
40
+ entered_options.remove(selected_option[0]) # Remove the selected option from the list
41
  filter_list.options = entered_options # Update the filter_list options
 
42
 
43
  add_option_button.on_click(add_new_option)
44
 
45
  # Layout using Template
46
  template = pn.template.FastListTemplate(
47
  title="EasySciRead",
48
+ header=[pn.Row(filter_list, add_option_button)],
49
  sidebar=[buttons],
50
  main=[
51
  pn.Column(text),