EasySci commited on
Commit
2e3df3f
·
1 Parent(s): e94815f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -8
app.py CHANGED
@@ -17,26 +17,39 @@ and reveal more information about the selected subgroup through the power
17
  of cross-filtering.
18
  """
19
 
 
 
20
  # Add filter list row with spacing
21
  filter_list = pn.widgets.CheckButtonGroup(
22
  name='Filter Options',
23
  options=["option1", "option2", "option3"],
24
  button_type='success',
25
- sizing_mode='fixed',
26
- button_style = 'solid',
27
- # button_type = 'default',
28
- margin=(5, 10)
29
  )
30
 
31
- text = pn.pane.Markdown(instructions)
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
  # Layout using Template
34
  template = pn.template.FastListTemplate(
35
- title="EasySciRead",
36
- sidebar=[buttons],
37
- header=[filter_list],
38
  main=[
39
  pn.Row(filter_list, sizing_mode='stretch_width'), # Filter list row before the text
 
 
40
  pn.Column(text),
41
  ],
42
  accent_base_color="#88d8b0",
 
17
  of cross-filtering.
18
  """
19
 
20
+ text = pn.pane.Markdown(instructions)
21
+
22
  # Add filter list row with spacing
23
  filter_list = pn.widgets.CheckButtonGroup(
24
  name='Filter Options',
25
  options=["option1", "option2", "option3"],
26
  button_type='success',
27
+ sizing_mode='fixed', # Use fixed sizing mode to add spacing
28
+ margin=(5, 10) # Adjust the margin to add spacing (vertical, horizontal)
 
 
29
  )
30
 
31
+ # Create a TextInput widget to get new filter options from the user
32
+ new_option_input = pn.widgets.TextInput(name="Add new filter option", value="", sizing_mode="stretch_width")
33
+
34
+ # Create an empty CheckboxGroup widget to hold the checklist for adding options
35
+ new_options_checklist = pn.widgets.CheckboxGroup(name="Choose options to add", options=[], sizing_mode="stretch_width")
36
+
37
+ # Callback for the "+" button to show the checklist for adding options
38
+ def show_checklist(event):
39
+ options = filter_list.options + [new_option_input.value]
40
+ new_options_checklist.options = options
41
+
42
+ # "+" button
43
+ add_option_button = Button(label="+", button_type="primary")
44
+ add_option_button.on_click(show_checklist)
45
 
46
  # Layout using Template
47
  template = pn.template.FastListTemplate(
48
+ title="EasySciRead",
 
 
49
  main=[
50
  pn.Row(filter_list, sizing_mode='stretch_width'), # Filter list row before the text
51
+ pn.Row(add_option_button, new_option_input), # Add the "+" button and input for new option
52
+ pn.Row(new_options_checklist), # Add the checklist row (initially empty)
53
  pn.Column(text),
54
  ],
55
  accent_base_color="#88d8b0",