Spaces:
Running
Running
Update app2.py
Browse files
app2.py
CHANGED
|
@@ -30,17 +30,21 @@ button2 = pn.widgets.Button(icon='file-analytics', name='My papers', icon_size='
|
|
| 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(
|
| 34 |
-
value =
|
| 35 |
-
value_change = pn.Any(None, doc="Event that is triggered when the value changes").tag(sync=True, events=True)
|
| 36 |
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
self.value_change = True
|
| 41 |
-
return changed
|
| 42 |
|
| 43 |
-
select = CustomRadioButtonGroup(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
# Create a column layout for the buttons inside the toggleable sidebar
|
| 46 |
buttons = pn.Column(
|
|
|
|
| 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(
|