Spaces:
Sleeping
Sleeping
Update app2.py
Browse files42 unmodified lines43444546474843 unmodified lines929394959697984 unmodified lines10310410510610710810911011111211311411511611740 unmodified lines15815916016116216316416542 unmodified lines# Create buttons for the toggleable sidebarbutton1 = pn.widgets.Button(icon='home', name="Home", icon_size='1.5em', button_type = 'primary', button_style = 'outline', width = 140)button2 = pn.widgets.Button(icon='file-analytics', name='My papers', icon_size='1.5em', button_type = 'primary', button_style = 'outline', width = 140)43 unmodified linesbuttons_to_add.append(option) # Add to header if not already presentfilter_list.value = [] # Clear the selected options after adding them to the headerupdate_header() # Update the header after adding optionsadd_to_header_button.on_click(add_to_header)# Function to update the header layout with the newly created buttons4 unmodified linesheader_button.on_click(remove_from_header) # Add callback to remove the header buttonheader_buttons.append(header_button)print("This is the button list2:", buttons_to_add, flush=True)run_tldr = partial(run_code, buttons_to_add)# Update the filter list options to exclude buttons that are already in the headerfilter_list.options = [option for option in entered_options if option not in buttons_to_add]# MultiChoice widget to display the filter options with delete buttonsfilter_list = pn.widgets.MultiChoice(name='',40 unmodified lines)# Run the apptemplate.servable()42 unmodified lines434445464748495043 unmodified lines9495969798991004 unmodified lines10510610710810911011111211311440 unmodified lines15515615715815916016116216316416516616716842 unmodified linesimport panel as pn# Create buttons for the toggleable sidebarbutton1 = pn.widgets.Button(icon='home', name="Home", icon_size='1.5em', button_type = 'primary', button_style = 'outline', width = 140)button2 = pn.widgets.Button(icon='file-analytics', name='My papers', icon_size='1.5em', button_type = 'primary', button_style = 'outline', width = 140)43 unmodified linesbuttons_to_add.append(option) # Add to header if not already presentfilter_list.value = [] # Clear the selected options after adding them to the headerupdate_header() # Update the header after adding optionsadd_to_header_button.on_click(add_to_header)# Function to update the header layout with the newly created buttons4 unmodified linesheader_button.on_click(remove_from_header) # Add callback to remove the header buttonheader_buttons.append(header_button)print(buttons_to_add, flush = True)# Update the filter list options to exclude buttons that are already in the headerfilter_list.options = [option for option in entered_options if option not in buttons_to_add]# MultiChoice widget to display the filter options with delete buttonsfilter_list = pn.widgets.MultiChoice(name='',40 unmodified lines)def run_code(event):# Add your desired Python code here# For example, let's print "Hello, Panel!" when the button is clickedprint("Hello, Panel!", flush = True)# Attach the function to the button's on_click eventbutton3.on_click(run_code)# Run the apptemplate.servable()
app2.py+10-7