EasySci commited on
Commit
7c0fda5
·
1 Parent(s): 1440463

Update app2.py

Browse files
Files changed (1) hide show
  1. app2.py +4 -18
app2.py CHANGED
@@ -29,22 +29,15 @@ button1 = pn.widgets.Button(icon='home', name="Home", icon_size='1.5em', button_
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 with additional value_change event
33
- class CustomRadioButtonGroup(param.Parameterized):
34
- value = param.String(default="⭐", doc="The selected value")
35
-
36
- @param.depends('value', watch=True)
37
- def _trigger_value_change(self):
38
- self.param.trigger('value_change')
39
-
40
- select = CustomRadioButtonGroup()
41
 
42
  # Function to display the selected value
43
  def display_selected_value(event):
44
  print(f"Selected value: {select.value}")
45
 
46
- # Attach the function to the CustomRadioButtonGroup's value_change event
47
- select.param.watch(display_selected_value, 'value_change')
48
 
49
  # Create a column layout for the buttons inside the toggleable sidebar
50
  buttons = pn.Column(
@@ -53,13 +46,6 @@ buttons = pn.Column(
53
  css_classes=['hidden']
54
  )
55
 
56
- # Function to display the selected value
57
- def display_selected_value(event):
58
- print(f"Selected value: {select.value}")
59
-
60
- # Attach the function to the CustomRadioButtonGroup's value_change event
61
- select.param.watch(display_selected_value, 'value_change')
62
-
63
  # List to store the entered options
64
  loaded_list = TLDR.load_categories()
65
 
 
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="⭐", options=["⭐", "🐘"], name='String', align='center')
 
 
 
 
 
 
 
34
 
35
  # Function to display the selected value
36
  def display_selected_value(event):
37
  print(f"Selected value: {select.value}")
38
 
39
+ # Attach the function to the RadioButtonGroup's on_click event
40
+ select.on_click(display_selected_value)
41
 
42
  # Create a column layout for the buttons inside the toggleable sidebar
43
  buttons = pn.Column(
 
46
  css_classes=['hidden']
47
  )
48
 
 
 
 
 
 
 
 
49
  # List to store the entered options
50
  loaded_list = TLDR.load_categories()
51