EasySci commited on
Commit
775bcf5
·
1 Parent(s): cf064eb

Update app2.py

Browse files
Files changed (1) hide show
  1. app2.py +10 -4
app2.py CHANGED
@@ -65,12 +65,19 @@ def toggle_settings(event):
65
 
66
  button3.param.watch(toggle_settings, 'value')
67
 
 
 
 
68
  # Function to reset the main panel content to the initial content
69
  def reset_main_panel(event):
70
- main_body_instance.main_body.clear() # Clear the existing main panel content
71
- main_body_instance.main_body.append(pn.pane.LaTeX("Please select some tags!", styles={'font-size': '20pt'}))
72
- main_body_instance.param.trigger('main_body') # Trigger the update manually
 
 
73
 
 
 
74
 
75
  # Function to update the main panel content when button3 is pressed
76
  def update_main_panel_button3(event):
@@ -79,7 +86,6 @@ def update_main_panel_button3(event):
79
  main_body_instance.param.trigger('main_body') # Trigger the update manually
80
 
81
  # Attach the functions to the on_click event of button1 and button3
82
- button1.on_click(reset_main_panel)
83
  button3.on_click(update_main_panel_button3)
84
 
85
  # Create the main panel with some initial content
 
65
 
66
  button3.param.watch(toggle_settings, 'value')
67
 
68
+ # Store the initial content of the main panel
69
+ initial_main_panel_content = pn.pane.LaTeX("Please select some tags!", styles={'font-size': '20pt'})
70
+
71
  # Function to reset the main panel content to the initial content
72
  def reset_main_panel(event):
73
+ # Clear the existing main panel content if it's not the initial content
74
+ if main_body_instance.main_body != [initial_main_panel_content]:
75
+ main_body_instance.main_body.clear()
76
+ main_body_instance.main_body.append(initial_main_panel_content)
77
+ main_body_instance.param.trigger('main_body') # Trigger the update manually
78
 
79
+ # Attach the reset_main_panel function to the on_click event of button1
80
+ button1.on_click(reset_main_panel)
81
 
82
  # Function to update the main panel content when button3 is pressed
83
  def update_main_panel_button3(event):
 
86
  main_body_instance.param.trigger('main_body') # Trigger the update manually
87
 
88
  # Attach the functions to the on_click event of button1 and button3
 
89
  button3.on_click(update_main_panel_button3)
90
 
91
  # Create the main panel with some initial content