EasySci commited on
Commit
4d29d29
·
1 Parent(s): 080bf38

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -40,10 +40,20 @@ def add_new_option(event):
40
  new_option = new_option_input.value.strip() # Remove leading/trailing spaces
41
  if new_option:
42
  entered_options.append(new_option) # Add the option to the list of entered options
 
43
  new_option_input.value = ""
44
 
45
  add_option_button.on_click(add_new_option)
46
 
 
 
 
 
 
 
 
 
 
47
  # Layout using Template
48
  template = pn.template.FastListTemplate(
49
  title="EasySciRead",
 
40
  new_option = new_option_input.value.strip() # Remove leading/trailing spaces
41
  if new_option:
42
  entered_options.append(new_option) # Add the option to the list of entered options
43
+ filter_list.options = entered_options # Update the filter_list options
44
  new_option_input.value = ""
45
 
46
  add_option_button.on_click(add_new_option)
47
 
48
+ # Callback for removing the selected option from the filter list
49
+ def remove_selected_option(event):
50
+ selected = filter_list.value
51
+ if selected:
52
+ entered_options.remove(selected[0]) # Remove the selected option from the entered options list
53
+ filter_list.options = entered_options # Update the filter_list options
54
+
55
+ filter_list.param.watch(remove_selected_option, 'value')
56
+
57
  # Layout using Template
58
  template = pn.template.FastListTemplate(
59
  title="EasySciRead",