EasySci commited on
Commit
d87ec9f
·
1 Parent(s): 819910a

Update app2.py

Browse files
Files changed (1) hide show
  1. app2.py +8 -9
app2.py CHANGED
@@ -23,19 +23,18 @@ paper_list = [] # Add this line to initialize paper_list as an empty list
23
  main_body = [pn.Row(pn.pane.Markdown("# Please select some tags!"))]
24
 
25
 
26
- # Create buttons for the toggleable sidebar
27
- button1 = pn.widgets.Button(icon='home', name="Home", icon_size='1.5em', button_type = 'primary', button_style = 'outline', width = 140)
28
- button2 = pn.widgets.Button(icon='file-analytics', name='My papers', icon_size='1.5em', button_type = 'primary', button_style = 'outline', width = 140)
29
- button3 = pn.widgets.Button(icon='settings', icon_size='1.5em', name='Settings', button_type = 'primary', button_style = 'outline', width = 140)
30
-
31
  # Create binary slider buttons for the sidebar
32
  toggle_button = pn.widgets.Toggle(name="Filter", on_text="filter1", off_text="filter2", width=140)
33
 
34
- # Create a callback to update the filter name when the button is toggled
35
- def update_filter_name(event):
36
- filter_name.object = toggle_button.on_text
 
 
 
37
 
38
- toggle_button.on_click(update_filter_name, 'value')
 
39
 
40
  # Create a column layout for the buttons inside the toggleable sidebar
41
  buttons = pn.Column(
 
23
  main_body = [pn.Row(pn.pane.Markdown("# Please select some tags!"))]
24
 
25
 
 
 
 
 
 
26
  # Create binary slider buttons for the sidebar
27
  toggle_button = pn.widgets.Toggle(name="Filter", on_text="filter1", off_text="filter2", width=140)
28
 
29
+ # Function to update the button name when toggled
30
+ def update_button_name(event):
31
+ if toggle_button.value:
32
+ toggle_button.name = "filter1"
33
+ else:
34
+ toggle_button.name = "filter2"
35
 
36
+ # Attach the update_button_name function to the button's on_click event
37
+ toggle_button.on_click(update_button_name)
38
 
39
  # Create a column layout for the buttons inside the toggleable sidebar
40
  buttons = pn.Column(