EasySci commited on
Commit
5f19ec5
·
1 Parent(s): cfd0bc7

Update app2.py

Browse files
Files changed (1) hide show
  1. app2.py +26 -6
app2.py CHANGED
@@ -27,15 +27,15 @@ main_body = [pn.pane.LaTeX("Please select some tags!", styles={'font-size': '20p
27
  # Create buttons for the toggleable sidebar
28
  button1 = pn.widgets.Button(icon='home', name="Home", icon_size='1.5em', button_type='primary', button_style='outline', width=140)
29
  button2 = pn.widgets.Button(icon='file-analytics', name='My papers', icon_size='1.5em', button_type='primary', button_style='outline', width=140)
30
- button3 = pn.widgets.Button(icon='settings', icon_size='1.5em', name='Settings', button_type='primary', button_style='outline', width=140)
31
 
32
  # Custom RadioButtonGroup widget
33
- select = pn.widgets.RadioButtonGroup(value="Scientic", options=["General", "Scientic"], name='String', align='center',button_type = 'default')
34
- select2 = pn.widgets.RadioButtonGroup(value="Normal", options=["Bionic", "Normal"], name='String', align='center',button_type = 'default')
35
 
36
  # Define a callback to display the selected value
37
  def display_selected_value(event):
38
- print(f"Selected value: {event.new}", flush = True)
39
 
40
  # Attach the callback to the value_change event of the RadioButtonGroup
41
  select.param.watch(display_selected_value, 'value')
@@ -44,11 +44,31 @@ select2.param.watch(display_selected_value, 'value')
44
  # Create a column layout for the buttons inside the toggleable sidebar
45
  buttons = pn.Column(
46
  button1, button2, button3,
47
- select,
48
- select2,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  css_classes=['hidden']
50
  )
51
 
 
 
 
 
 
 
52
  # List to store the entered options
53
  loaded_list = TLDR.load_categories()
54
 
 
27
  # Create buttons for the toggleable sidebar
28
  button1 = pn.widgets.Button(icon='home', name="Home", icon_size='1.5em', button_type='primary', button_style='outline', width=140)
29
  button2 = pn.widgets.Button(icon='file-analytics', name='My papers', icon_size='1.5em', button_type='primary', button_style='outline', width=140)
30
+ button3 = pn.widgets.Toggle(name='Settings', button_type='primary', button_style='outline', width=140, value=False)
31
 
32
  # Custom RadioButtonGroup widget
33
+ select = pn.widgets.RadioButtonGroup(value="Scientic", options=["General", "Scientic"], name='String', align='center', button_type='default')
34
+ select2 = pn.widgets.RadioButtonGroup(value="Normal", options=["Bionic", "Normal"], name='String', align='center', button_type='default')
35
 
36
  # Define a callback to display the selected value
37
  def display_selected_value(event):
38
+ print(f"Selected value: {event.new}", flush=True)
39
 
40
  # Attach the callback to the value_change event of the RadioButtonGroup
41
  select.param.watch(display_selected_value, 'value')
 
44
  # Create a column layout for the buttons inside the toggleable sidebar
45
  buttons = pn.Column(
46
  button1, button2, button3,
47
+ pn.Column(
48
+ pn.Param(
49
+ select,
50
+ show_name=False,
51
+ sizing_mode='stretch_width',
52
+ default_layout=pn.Row
53
+ ),
54
+ pn.Param(
55
+ select2,
56
+ show_name=False,
57
+ sizing_mode='stretch_width',
58
+ default_layout=pn.Row
59
+ ),
60
+ visible=False,
61
+ sizing_mode='stretch_width',
62
+ ),
63
  css_classes=['hidden']
64
  )
65
 
66
+ # Define a callback to show/hide the select buttons when "Settings" button is toggled
67
+ def toggle_settings(event):
68
+ buttons[-1].visible = event.new
69
+
70
+ button3.param.watch(toggle_settings, 'value')
71
+
72
  # List to store the entered options
73
  loaded_list = TLDR.load_categories()
74